码迷,mamicode.com
首页 > 其他好文 > 详细

排除不必要的绘制区域,降低绘制量

时间:2014-08-26 17:16:36      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   os   ar   问题   div   log   sp   

 

 

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;

 

排除不必要的绘制区域,降低绘制量

标签:style   blog   color   os   ar   问题   div   log   sp   

原文地址:http://www.cnblogs.com/gleam/p/3937510.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!