procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);var
rect1:Trect;
begin
canvas.Rectangle(x,y,x+100,y+20);
rect1.left:=x;
rect1.Top:=y;
rect1.Right:=x+100;
rect1.Bottom:=y+20;
canvas.textrect(rect1,x,y,InputBox('请输入字符串','字符串',''));
end;
当我画了矩形并填写了一行字符串后,会出现矩形的部分或全部边框消失的情况,请问这
是什么原因,是不是有什么输出文本范围的属性要设置啊,非常感谢!!!!
Shift: TShiftState; X, Y: Integer);var
rect1:Trect;
begin
canvas.Rectangle(x,y,x+100,y+20);
rect1.left:=x;
rect1.Top:=y;
rect1.Right:=x+100;
rect1.Bottom:=y+20;
canvas.textrect(rect1,x,y,InputBox('请输入字符串','字符串',''));
end;
当我画了矩形并填写了一行字符串后,会出现矩形的部分或全部边框消失的情况,请问这
是什么原因,是不是有什么输出文本范围的属性要设置啊,非常感谢!!!!
Shift: TShiftState; X, Y: Integer);var
rect1:Trect;
begin
canvas.Rectangle(x,y,x+100,y+20);
rect1.left:=x + 1;
rect1.Top:= y + 1;
rect1.Right:=x+99;
rect1.Bottom:=y+19;
canvas.textrect(rect1,x,y,InputBox('请输入字符串','字符串',''));
end;这样才不会把边框填了.
因为 textrect 过程是用当前画布颜色来填充的
Image 控件的 Align 属性设为 alClient;
Visible 属性设为 False;
上边的代码改为以下
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);var
rect1:Trect;
begin
Image1.Canvas.Brush.Style := Canvas.Brush.Style;
Image1.Canvas.Brush.color := canvas.Brush.Color;
Image1.canvas.Rectangle(x,y,x+100,y+20);
canvas.Rectangle(x,y,x+100,y+20);
rect1.left:=x + 1;
rect1.Top:= y + 1;
rect1.Right:=x+99;
rect1.Bottom:=y+19;
Image1.canvas.textrect(rect1,x,y,InputBox('请输入字符串','字符串',''));
canvas.CopyRect(Rect(x,y,x+100,y+20), Image1.Canvas, Rect(x,y,x+100,y+20));
end;
~~~~~~~~~~~~~~但这里写的是MouseDown啊