Delphi WinAPI: InflateRect – 改变矩形大小

WinAPI: InflateRect – 改变矩形大小
//声明:
InflateRect(
  var lprc: TRect; {要修改的矩形}
  dx, dy: Integer  {变化值}
): BOOL;
//举例:
procedure TForm1.FormPaint(Sender: TObject);
var
  R: TRect;
const
  s = “%d,%d,%d,%d”;
begin
  R := Rect(60, 60, 200, 150);
  DrawFocusRect(Canvas.Handle, R);
  Canvas.TextOut(R.Left, R.Top-15, Format(s,[R.Left,R.Top,R.Right,R.Bottom]));
  InflateRect(R, 20, 20);
  DrawFocusRect(Canvas.Handle, R);
  Canvas.TextOut(R.Left, R.Top-15, Format(s,[R.Left,R.Top,R.Right,R.Bottom]));
  InflateRect(R, -40, -40);
  DrawFocusRect(Canvas.Handle, R);
  Canvas.TextOut(R.Left, R.Top-15, Format(s,[R.Left,R.Top,R.Right,R.Bottom]));
end;
//效果图:
图片[1]-Delphi WinAPI: InflateRect – 改变矩形大小-Delphi编程技巧大全
THE END
文章版权归作者所有,未经允许请勿转载。
点赞6赞赏
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片