TPanel.Canvas ?

How Can i access to The TPanel.Canvas property ?

I am writing a annual calendar component. Each day is a TPanel. It works fine, but now i want to be abble to write :
1) In the Top Left Corner, in bold : the day number
2) In the Bottom right corner, in standard style : another number (User defined)

So, how could i do ?
The source code for the component is ready to use another object for the days. But this one have to publish all Drag events (used for multi-selection)
Who is Participating?
BlackManConnect With a Mentor Commented:
You can't! What you can to it to create a TPanel decendant component that creates a TBitmap in it's constuctor and then put your controls on the bitmap..
Hi helpme,

what about using TLables?

Make your own TPanel, inherit the TCustomPanel and overide the Paint method.

Regards, Zif.
Hi blackman. See that you were first :-)
Hi there,
You can get the canvas, on almost all control like this,
you have to make your own canvas....

procedure TForm1.Button1Click(Sender: TObject);
var DC: HDC;
    Canvas: TCanvas;
     Canvas.Handle := DC;

Hope this will help you....
Smilly u also should release the DC..

ReleaseDC(Panel1.Handle, DC);

Merry Christmas!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.