procedure DrawBorder(Handle: THandle; ADC: HDC); var R: TRect; Canvas: TCanvas; P: TPoint; begin Canvas := TCanvas.Create; Canvas.Handle := ADC; P := Point(0, 0); Windows.ClientToScreen(Handle, P); Windows.GetWindowRect(Handle, R); P.X := P.X - R.Left; P.Y := P.Y - R.Top; Windows.GetClientRect(Handle, R); /// 排除不需要绘制的区域 /// 优点: 1、不会绘出界外 /// 2、当面积比较大如背景,拖拽缩放时不会出现大面积色块问题 /// ExcludeClipRect(Canvas.Handle, P.X, P.Y, R.Right - R.Left + P.X, R.Bottom - R.Top + P.Y); Windows.GetWindowRect(Handle, R); OffsetRect(R, -R.Left, -R.Top); /// 绘制背景 ///PaintBackground(Canvas, R); /// 清除剪切区域 SelectClipRgn(Canvas.Handle, 0); Canvas.Handle := 0; Canvas.Free; end;
时间: 2024-10-12 21:50:39