delphi绘图
2016-10-24 本文已影响0人
风语007
procedure TForm1.Button3Click(Sender: TObject);
var
flag: integer;
FixRect: TRect;
no:string;
begin
PaintBox1.Canvas.Brush.Color := clRed;
PaintBox1.Canvas.FillRect(PaintBox1.ClientRect);
PaintBox1.Canvas.Brush.Color := clBlue;
FixRect := PaintBox1.ClientRect;
FixRect.Left := FixRect.Left-5;
FixRect.Top := FixRect.Top-5;
FixRect.Right := FixRect.Right-10;
FixRect.Bottom := FixRect.Bottom-10;
PaintBox1.Canvas.FillRect(FixRect);
PaintBox1.Canvas.Brush.Color := clYellow;
no := 'HELLOWORLDHELLOWOR\nFJEOJEEJGOEGJOEGJOE';
// Flag := DT_SINGLELINE or DT_RIGHT or DT_CENTER;
flag := DT_VCENTER;
DrawText(PaintBox1.Canvas.Handle, PChar(No), Length(No), FixRect, Flag);
end;