mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 08:01:43 +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
@ -937,14 +937,14 @@ begin
|
|||||||
if HasIcon then
|
if HasIcon then
|
||||||
begin
|
begin
|
||||||
AImageList := GetImageList;
|
AImageList := GetImageList;
|
||||||
if AImageList <> nil then
|
if (AImageList <> nil) and (FImageIndex >= 0) then // using size of ImageList
|
||||||
begin
|
begin
|
||||||
if (FImageIndex < 0) or (FImageIndex >= AImageList.Count) then
|
if (FImageIndex >= AImageList.Count) then
|
||||||
Exit;
|
Exit;
|
||||||
Result.x := AImageList.Width;
|
Result.x := AImageList.Width;
|
||||||
Result.y := AImageList.Height;
|
Result.y := AImageList.Height;
|
||||||
end
|
end
|
||||||
else
|
else // using size of Bitmap
|
||||||
begin
|
begin
|
||||||
Result.x := Bitmap.Width;
|
Result.x := Bitmap.Width;
|
||||||
Result.y := Bitmap.Height;
|
Result.y := Bitmap.Height;
|
||||||
|
@ -1098,7 +1098,7 @@ var
|
|||||||
AImageIndex: Integer;
|
AImageIndex: Integer;
|
||||||
begin
|
begin
|
||||||
AImageList := AMenuItem.GetImageList;
|
AImageList := AMenuItem.GetImageList;
|
||||||
if AImageList = nil then
|
if (AImageList = nil) or (AMenuItem.ImageIndex < 0) then // using icon from Bitmap
|
||||||
begin
|
begin
|
||||||
AImageList := TImageList.Create(nil);
|
AImageList := TImageList.Create(nil);
|
||||||
AImageList.Width := AMenuItem.Bitmap.Width; // maybe height to prevent too wide bitmaps?
|
AImageList.Width := AMenuItem.Bitmap.Width; // maybe height to prevent too wide bitmaps?
|
||||||
@ -1106,7 +1106,7 @@ begin
|
|||||||
AImageIndex := AImageList.Add(AMenuItem.Bitmap, nil);
|
AImageIndex := AImageList.Add(AMenuItem.Bitmap, nil);
|
||||||
FreeImageList := True;
|
FreeImageList := True;
|
||||||
end
|
end
|
||||||
else
|
else // using icon from ImageList
|
||||||
begin
|
begin
|
||||||
FreeImageList := False;
|
FreeImageList := False;
|
||||||
AImageIndex := AMenuItem.ImageIndex;
|
AImageIndex := AMenuItem.ImageIndex;
|
||||||
|
Loading…
Reference in New Issue
Block a user