Re: TCanvas

Jörn Zietz <[email protected]> Fri, 22 Aug 2003 00:00:02 +0200
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <[email protected]>
Hi Eber,

> How can I insert a TCanvas component in a Delphi form. I'm using Delphi 6,
> but I culdn't find this component in the component's palettes.

TCanvas is not a component (TComponent). Many visual components have a
property 'Canvas' which you can use. If you want to draw on your form
you can use

   YourForm.Canvas.MoveTo(10, 10);
   YourForm.Canvas.LineTo(100, 100);

Code that paints something is usually placed in an OnPaint-Event (in
the upper case of YourForm). This code is automatically executed
whenever the form needs to be repainted eg when the form is brought to
top again.

If you want to draw something that exceeds the forms size you should
place a PaintBox within a ScrollBox on the form. Then you can set the
width and height of the PaintBox to the size you need an the scrollbox
shows scrollbars if needed. To draw stuff use the PaintBox.Canvas in
the PaintBox.OnPaint.

HTH.

-- 
Cheers,
Joern


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/i7folB/TM
---------------------------------------------------------------------~->

Delphi VCL Top Sites!
http://www.sandbrooksoftware.com/TS/TS2/Components.shtml
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/