mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-25 16:49:04 +02:00
LCL: Fix errors when using TMainMenu.Images and Bitmap. Issue #27069, patch from Denis Kozlov.
git-svn-id: trunk@46977 -
This commit is contained in:
parent
45eab13451
commit
469cfdbb40
lcl
@ -937,14 +937,14 @@ begin
|
||||
if HasIcon then
|
||||
begin
|
||||
AImageList := GetImageList;
|
||||
if AImageList <> nil then
|
||||
if (AImageList <> nil) and (FImageIndex >= 0) then // using size of ImageList
|
||||
begin
|
||||
if (FImageIndex < 0) or (FImageIndex >= AImageList.Count) then
|
||||
if (FImageIndex >= AImageList.Count) then
|
||||
Exit;
|
||||
Result.x := AImageList.Width;
|
||||
Result.y := AImageList.Height;
|
||||
end
|
||||
else
|
||||
else // using size of Bitmap
|
||||
begin
|
||||
Result.x := Bitmap.Width;
|
||||
Result.y := Bitmap.Height;
|
||||
|
@ -1098,7 +1098,7 @@ var
|
||||
AImageIndex: Integer;
|
||||
begin
|
||||
AImageList := AMenuItem.GetImageList;
|
||||
if AImageList = nil then
|
||||
if (AImageList = nil) or (AMenuItem.ImageIndex < 0) then // using icon from Bitmap
|
||||
begin
|
||||
AImageList := TImageList.Create(nil);
|
||||
AImageList.Width := AMenuItem.Bitmap.Width; // maybe height to prevent too wide bitmaps?
|
||||
@ -1106,7 +1106,7 @@ begin
|
||||
AImageIndex := AImageList.Add(AMenuItem.Bitmap, nil);
|
||||
FreeImageList := True;
|
||||
end
|
||||
else
|
||||
else // using icon from ImageList
|
||||
begin
|
||||
FreeImageList := False;
|
||||
AImageIndex := AMenuItem.ImageIndex;
|
||||
|
Loading…
Reference in New Issue
Block a user