Board index » cppbuilder » creating Canvas

creating Canvas


2005-05-14 04:51:08 PM
cppbuilder68
I want create a Canvas in a TFrame object.
in the TFrame constructor I put these lines:
canv = new TCanvas();
canv->Handle = this->WindowHandle;
canv->FrameRect(this->ClientRect);
but here the ClipRect property of canv is (0,0,0,0) and I can't draw
anything.
ther's something else to do?
luca
 
 

Re:creating Canvas

"luca casotti" < XXXX@XXXXX.COM >wrote in message
Quote
I want create a Canvas in a TFrame object.
Look at TControlCanvas.
Quote
canv->Handle = this->WindowHandle;
That will not work. A Window Handle (HWND) is not a valid Canvas Handle
(HDC).
Gambit
 

Re:creating Canvas

Remy wrote:
Quote
Look at TControlCanvas.
To expand upon this further:
If you look at the VCL source for TCustomForm, which has a public
Canvas property, you will see that it declares a private variable to hold
the TControlCanvas (pointer), a public read-only Canvas property,
and a getter function to return the TControlCanvas (pointer). In the
constructor, the TControlCanvas is created, and the TCustomForm
(pointer) is assigned to the TControlCanvas' Control property. The
TControlCanvas is deleted in the destructor of the TCustomForm.
You might do the same with your TFrame descendent...
 

{smallsort}