Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Canvas and TScrollBox

461 views
Skip to first unread message

Del Gutierrez

unread,
Jan 11, 1998, 3:00:00 AM1/11/98
to

How ould I accomplish adding a Canvas property to the TScrollBox
control?
TIA, Del G.

Peter Below

unread,
Jan 11, 1998, 3:00:00 AM1/11/98
to

In article <34B86368.7812@No_Spam_FirstPlus.com>, Del Gutierrez wrote:
> How ould I accomplish adding a Canvas property to the TScrollBox
> control?
>
Del,

if you have the VCL source look at the way TCustomControl is implementing
its canvas and the Paint mechanism. That is about what you would have to
add to a descendent of TScrollbox to give it a canvas: a private field that
holds the canvas, a constructor that creates it, a destructor that frees
it, a handler for WM_PAINT that sets up the canvas and calls the Paint
method etc..

Another option would be to fill the scrollbox with a TCustomControl
descendent with Align := alClient and publish that controls Canvas in a
Canvas property of the parent scrollbox.

Peter Below (TeamB) 10011...@compuserve.com)


Brian Lowe

unread,
Jan 11, 1998, 3:00:00 AM1/11/98
to

Add a private TControlCanvas object and set its Control property to the
TScrollBox. Then override the .Paint method and draw on the
TControlCanvas.

Brian Lowe
Acro Technology Inc.
(formerly Beond Technology Corp.)

Del Gutierrez wrote:
>
> How ould I accomplish adding a Canvas property to the TScrollBox
> control?

> TIA, Del G.

Del Gutierrez

unread,
Jan 11, 1998, 3:00:00 AM1/11/98
to

Peter Below wrote:

>
> In article <34B86368.7812@No_Spam_FirstPlus.com>, Del Gutierrez wrote:
> > How ould I accomplish adding a Canvas property to the TScrollBox
> > control?
> >
> Del,
>
> if you have the VCL source look at the way TCustomControl is implementing
> its canvas and the Paint mechanism. That is about what you would have to
> add to a descendent of TScrollbox to give it a canvas: a private field that
> holds the canvas, a constructor that creates it, a destructor that frees
> it, a handler for WM_PAINT that sets up the canvas and calls the Paint
> method etc..
>
> Another option would be to fill the scrollbox with a TCustomControl
> descendent with Align := alClient and publish that controls Canvas in a
> Canvas property of the parent scrollbox.
>
> Peter Below (TeamB) 10011...@compuserve.com)

Peter,

I did indeed check out the source of the VCL and in particular, the
source for TCumstomControl. To a derived TScollBox, I added a FCanvas
property, a WMPaint message handler and the paint method.
Unfortunately, that is what prompted my question since every time I try
to draw to that Canvas, I get the message 'Canvas does not allow
drawing.' (Verbatim from Delphi 3.01.) Now what?

TIA, Del G.

P.S. As a quick workaround, I'll try a TCustomControl critter with
Align := alClient. Thanks, Del G.

0 new messages