Well I DID find the problem, it was where I was doing it.
I was trying to do the stuff BEFORE the control had a handle....so I have
fixed it now.
Thanks, Jeremy Coulter
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Alistair George
> Sent: Friday, August 27, 1999 16:40
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Control Has No Window...agh
>
>
>
> 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
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz