Solved

TPanel.Canvas ?

Posted on 1998-12-23
5
232 Views
Last Modified: 2010-04-04
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)
0
Comment
Question by:helpme020897
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 7

Accepted Solution

by:
BlackMan earned 100 total points
ID: 1352702
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..
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1352703
Hi helpme,

what about using TLables?

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

Regards, Zif.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1352704
Hi blackman. See that you were first :-)
0
 
LVL 1

Expert Comment

by:Smilly
ID: 1352705
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....
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1352706
Smilly u also should release the DC..

ReleaseDC(Panel1.Handle, DC);

Merry Christmas!

-Viktor
--Ivanov
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question