self refers to the current instance of TNewPanel.
'newpanel' sounds like a global object of type TNewPanel (ala 'Form1'),
and so points to just one instance of TNewPanel.
'self' is certainly the way to go.
If there are two TNewPanel objects plonked onto a form, which one would
'newpanel' point at?
Who would assign a value to 'newpanel'?
Cheers,
Kerry "I'm going home, it's Friday!" S
--- Alistair George <[EMAIL PROTECTED]> wrote:
>
> I'm not particularly brills on this either Jeremy, but I think self
> is
> wrong.
> so fdc should be either
> fdc:=getdc(newpanel.canvas.Handle);
> or you could do
> with newpanel do
> DrawText(canvas.handle,............
> or
> DrawText(newpanel.canvas.handle
>
> but when you release it should be:
>
> > procedure TNewPanel.AddText(fCaption:string);
> > var
> > fRect:TRect;
> > fdc:HDC;
> > begin
> > fdc:=getdc(self.canvas.Handle);
> > fRect:= rect(10,10,100,100);
> > DrawText(fdc, PChar(fCaption), -1, fRect, 1);
> > releasedc(self.canvas.Handle,fDc);
> > end;
> >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On
> > > Behalf Of Carl Reynolds
> > > Sent: Friday, August 27, 1999 14:52
> > > To: Multiple recipients of list delphi
> > > Subject: RE: [DUG]: Control Has No Window...agh
> > >
> > >
> > > Actually, if JeremyWin has a canvas, this will do:
> > >
> > > DrawText(JeremyWin.canvas.handle,........
> > >
> > > But it was still a better suggestion than what I suggested:
> > >
> > > >Er, the Handle property of TWinControl. :)
> > >
> > > Bollocks, it must be a Friday...
> > >
> > > Carl Reynolds Ph: +64-9-4154790
> > > CJN Technologies Ltd. Fax: +64-9-4154791
> > > [EMAIL PROTECTED] DDI: +64-9-4154795
> > > PO Box 302-278, North Harbour, Auckland, New Zealand
> > > 12 Piermark Drive, North Harbour Estate, Auckland, NZ
> > > Visit our website at http://www.cjntech.co.nz/
> > >
> > > > -----Original Message-----
> > > > From: Alistair George [SMTP:[EMAIL PROTECTED]]
> > > > Sent: Friday, August 27, 1999 2:27 PM
> > > > To: Multiple recipients of list delphi
> > > > Subject: RE: [DUG]: Control Has No Window...agh
> > > >
> > > > > I have created a control based on a TWinControl.
> > > > > I want to use DrawText procedure, BUT I need a handle.
> > > > Doesnt:
> > > > var hdc:integer;
> > > > begin
> > > > hDC := GetDC(JeremyWin.canvas.handle);
> > > > DrawText(hDC,........
> > > >
>
----------------------------------------------------------------------
> > > > -----
> > > > New Zealand Delphi Users group - Delphi List -
> > > > [EMAIL PROTECTED]
> > > > Website: http://www.delphi.org.nz
> > >
> >
> >
> > ------------------------------------------------------------------
> > ---------
> > New Zealand Delphi Users group - Delphi List -
> [EMAIL PROTECTED]
> > Website: http://www.delphi.org.nz
> >
>
>
---------------------------------------------------------------------------
> New Zealand Delphi Users group - Delphi List -
> [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
>
>
_______________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com.au address at http://mail.yahoo.com.au
or your free @yahoo.co.nz address at http://mail.yahoo.co.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz