[Delphi] Copy to clipboard 2 TChart's

Pagina: 1
Acties:

  • ArieProductions
  • Registratie: Januari 2002
  • Laatst online: 27-11-2024
Ik heb twee TChart objecten, allebei met een mooi grafiekje.
Maar nu wil ik ze beide in een Metafile naar het clipboard copieeren.

Kan natuurlijk eerst beide TCharts overzetten naar een bitmap, maar dan verlies je kwaliteit wanneer je bijvoorbeeld in 'Word' het plaatje veranderd.

Mogelijke Bitmap achtige oplossing:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
uses Clipbrd;
...

procedure ConvertGraphsToBitmap(aChart1, aChart2: TChart);
var
  R1, R2 : TRect;
  Bitmap : TBitmap;

begin
  Bitmap := TBitmap.Create;
  Try
    R1 := Rect(0, 0, aChart1.width , aChart1.Height);
    R2 := Rect(0, aChart1.Height, aChart2.width ,  aChart1.Height + aChart2.Height);

    Bitmap.Width := aChart1.width;
    Bitmap.Height := aChart1.Height + aChart2.Height ;

    aChart1.Draw( Bitmap.Canvas , R1 ) ;
    aChart2.Draw( Bitmap.Canvas , R2 ) ;

    ClipBoard.Assign(Bitmap);
  Finally
    Bitmap.Free;
  End;

end;

Dus zoek zoiets alleen dan voor EMF type file

"Quidquid latine dictum sit, altum videtur" (Whatever is said in Latin sounds profound)