Ownerpaint Textbox

<< Click to Display Table of Contents >>

Navigation:  Programming > WPTools Premium > Text boxes >

Ownerpaint Textbox

To make a text box appear with a background:

 

clip0187_prem

 

use the code

 

procedure TWPORTFTextBox.Paint(toCanvas: TCanvas; BoundsRect: TRect;

     ParentTxtObj: TWPTextObj; PaintMode: TWPTextObjectPaintModes);

begin

if toCanvas <> nil then

begin

   toCanvas.Pen.Style := psSolid;

   toCanvas.Pen.Color := clBlack;

   toCanvas.Pen.Width := 0;

   toCanvas.Brush.Color := clGray;

   toCanvas.Brush.Style := bsFDiagonal;

   toCanvas.Rectangle( BoundsRect.Left, BoundsRect.Top, BoundsRect.Right, BoundsRect.Bottom );

end else inherited Paint(toCanvas, BoundsRect,ParentTxtObj, PaintMode);

end;