Board index » delphi » need help about this drawing problem
Erick Hartanto
![]() Delphi Developer |
need help about this drawing problem2005-10-27 11:28:15 PM delphi253 hi, i have a drawing problem here please help, here is the simple code ============================================ procedure CustomDraw(DC: HDC; R: TRect); var Canvas: TCanvas; begin Canvas := TCanvas.Create; try Canvas.Handle := DC; Canvas.Brush.Color := clSkyBlue; Canvas.FillRect(R); finally Canvas.Handle := 0; Canvas.Free; end; end; {pb is paint box} procedure TForm1.pbPaint(Sender: TObject); var R: TRect; begin R := pb.ClientRect; CustomDraw(pb.Canvas.Handle, R); pb.Canvas.TextOut(0, 0, 'Hello'); end; ================================================ the problem is 'Hello' text is not properly drawed according to the font. i think the problem lies on CustomDraw procedure that i miss something but i don't know what I am missing thanks in advance |