hi
i've stumbled across a problem i have pictures in imagelist. Then i try to resize picture from imagelist in temp image and i show result in picture on the form. but if i put temporary picture on form it works like a charm but if i want to create temporary image at runtime it doesnt work ..can anyone tell me what im missing ? code is as follows. .with temporary runtime ..picture is shown but its not resized as it should be. but if i use imgTmp thats on the form it works.
TFormCasleSiege = class(TForm)
private
procedure setImage(myImage: string);
znakJeOk:boolean;
imgTemp2 : TImage;
public
end;
procedure TFormCasleSiege.FormCreate(Sender: TObject);
begin
imgTemp2 := TImage.Create(self);
imgTemp2.Canvas.Create();
imgTemp2.Canvas.CreateBrush();
imgTemp2.Picture.Create;
imgTemp2.AutoSize := true;
imgTemp2.Stretch:=true;
imgTemp2.StretchInEnabled:=true;
imgTemp2.StretchOutEnabled:=true;
imgTemp2.Proportional:=true;
imgTemp2.KeepOriginXWhenClipped:=true;
imgTemp2.KeepOriginYWhenClipped:=true;
imgTemp2.Transparent:=true;
imgTemp2.Canvas.AutoRedraw:=true;
imgTemp2.width := 578;
imgTemp2.Height := 286;
end;
procedure TFormCasleSiege.setImage(myImage: string);
var destRectKL, destRect: TRect;
begin
destRectKL.Create(0,0,288,140);
destRect.Create(0,0,90,139);
ImgList.Draw(imgTemp2.canvas,0,0,0);
imgTemp2.Canvas.StretchDraw(destRectKL,imgTemp2.Picture.Graphic);
ImgCastles.Canvas.CopyRect(destRectKL,imgTemp2.Canvas,destRectKL);
end;