helpme020897
asked on
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)
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)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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;
begin
DC:=GetDC(panel1.handle);
Canvas:=TCanvas.Create;
Canvas.Handle := DC;
Canvas.LineTo(100,100);
Canvas.Free;
end;
Hope this will help you....
You can get the canvas, on almost all control like this,
you have to make your own canvas....
procedure TForm1.Button1Click(Sender
var DC: HDC;
Canvas: TCanvas;
begin
DC:=GetDC(panel1.handle);
Canvas:=TCanvas.Create;
Canvas.Handle := DC;
Canvas.LineTo(100,100);
Canvas.Free;
end;
Hope this will help you....
Smilly u also should release the DC..
ReleaseDC(Panel1.Handle, DC);
Merry Christmas!
-Viktor
--Ivanov
ReleaseDC(Panel1.Handle, DC);
Merry Christmas!
-Viktor
--Ivanov
what about using TLables?
Make your own TPanel, inherit the TCustomPanel and overide the Paint method.
Regards, Zif.