[Lazarus] Graphics changes (r15472)
Marc Weustink
marc at dommelstein.net
Sun Jun 22 01:01:37 CEST 2008
Felipe Monteiro de Carvalho wrote:
> The new image changes made TTrayIcon stop working.
>
> The following trivial code no longer works and crashes (from trayicon example):
>
> procedure TfrmTrayTest.btnPaintTestClick(Sender: TObject);
> var
> SecondImage: TIcon;
> begin
> SecondImage := TIcon.Create;
>
> try
> SecondImage.Height := 22;
> SecondImage.Width := 22;
> {$IFDEF FPC}
> SecondImage.Canvas.Draw(0, 0, MyImage);
> {$ENDIF}
> Canvas.Draw(0, 0, SecondImage);
> finally
> SecondImage.Free;
> end;
> end;
>
> TApplication.HandleException Cannot change size of icon image
Yes, you cannot change the size of an Icon, since an icon contains on or
more images of different sizes/depths
Use Icon.Add() to add a new image with given size and depth, then use
TIcon.Current to select the wanted image.
Marc
More information about the Lazarus
mailing list