Mega Code Archive

 
Categories / Delphi / Graphic
 

How prevent loosing Canvas modification

Title: How prevent loosing Canvas modification Question: when you're using canvas (Textout of exemple) and refreshing your application, you will loose your modofication Answer: Juste use a TImage !!! :o) Exemple : object Form1: TForm1 Left = 438 Top = 257 Width = 193 Height = 149 object Image1: TImage Left = 0 Top = 0 Width = 185 Height = 41 Align = alTop Transparent = True end object Button1: TButton Left = 8 Top = 88 Width = 75 Height = 25 Caption = 'Add text' TabOrder = 0 OnClick = Button1Click end object Button2: TButton Left = 104 Top = 88 Width = 75 Height = 25 Caption = 'Minimize' TabOrder = 1 OnClick = Button2Click end end //MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW* //Add this code and test... procedure TForm1.Button1Click(Sender: TObject); begin Image1.Canvas.textout(0,0,'This text whill stay after refreshing'); Canvas.textout(0,50,'This text whill be lost after refreshing'); end; procedure TForm1.Button2Click(Sender: TObject); begin WindowState := wsMinimized; end;