How to cast TCanvas3D to TCanvas and vice a versa

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Raju S Nair
Newbie
Newbie
Posts: 10
Joined: Wed Sep 28, 2005 4:00 am

How to cast TCanvas3D to TCanvas and vice a versa

Post by Raju S Nair » Tue Nov 21, 2006 10:29 am

I need to pass the canvas of the VCL as parameter to some methods who in turn do some drawing operations on the canvas. For this I need to do class casting from TCavas3D to TCanvas and vice a versa. But it seems that since both of these are not compatible so compiler complains and does not even compiles the code.

Can some one please help some alternative.

Thanks in advance

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Nov 21, 2006 10:41 am

Hi Sunil,

To cast from a TCanvas3D to a TCanvas you can use this:

Code: Select all

  DBChart1.Canvas.ReferenceCanvas
For the inverse operation this:

Code: Select all

var MyCanvas: TCanvas;
begin
  MyCanvas:=TCanvas.Create;
  (MyCanvas as TCanvas3D).Rectangle(...);
end;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply