Mega Code Archive

 
Categories / Delphi / VCL
 

Tmetafile [wmf, emf] uzerinde nasil degisiklik yapilir

{ TMetaFile'in TBitmap gibi bir canvas'i yok. Bu yuzden canvas'i bizim olusturmamiz gerekiyor} procedure TForm1.Button1Click(Sender: TObject); var WMFFile: TMetaFile; begin WMFFile := TMetaFile.Create; with TMetafileCanvas.Create(WMFFile, 0) do try Brush.Color := clRed; Ellipse(0,0,100,100); finally Free; end; Form1.Canvas.Draw(0,0,WMFFile); (* 1 red circle *) // Var olan bir Metafile'a degisiklik yapmak icin with TMetafileCanvas.Create(WMFFile, 0) do try Draw(0,0,WMFFile); Brush.Color := clBlue; Ellipse(100,100,200,200); finally Free; end; Form1.Canvas.Draw(0,0,WMFFile); (* 1 red circle and 1 blue circle *) WMFFile.SaveToFile('C:\deneme.wmf'); Image1.Picture.LoadFromFile('C:\deneme.wmf'); WMFFile.Free; end;