8.3.5 使用CopyMode属性中的那个例子。其中的一段:
procedure TMainForm.GetCanvasRect(AImage: TImage; var ARect: TRect);
var
  R: TRect;
  R2: TRect;
begin
  R := AImage.Canvas.ClipRect;  //这个地方有什么用?用得上吗?
  with AImage do begin
    ARect.TopLeft     := Point(0, 0);  
    ARect.BottomRight := Point(Width, Height);
  end;
  R2 := ARect;
  ARect := R2;  //这两句有什么用?有必要吗?
end;
谢谢了!!

解决方案 »

  1.   

    8.3.5 使用CopyMode属性中的那个例子。其中的一段:
    procedure TMainForm.GetCanvasRect(AImage: TImage; var ARect: TRect);
    var
      R: TRect;
      R2: TRect;
    begin
      R := AImage.Canvas.ClipRect;  //这个地方有什么用?用得上吗?
      with AImage do begin
        ARect.TopLeft     := Point(0, 0);  
        ARect.BottomRight := Point(Width, Height);
      end;
      R2 := ARect;
      ARect := R2;  //这两句有什么用?有必要吗?
    end;
    我试一试,别见笑啊,嘿嘿8.3.5 使用CopyMode属性中的那个例子。其中的一段:
    procedure TMainForm.GetCanvasRect(AImage: TImage; var ARect: TRect);
    var
      R: TRect;
      R2: TRect;
    begin
      R := AImage.Canvas.ClipRect;  //这个地方有什么用?用得上吗?
    {当然用得上了,ClipRect的作用是在OnPaint中决定哪些部分需要绘制,而哪些部分不需要绘制,这样可以尽快绘制速度。你不能直接设置该属性。如果你希望强制重绘某部分,应该使用API函数InvalidateRect。 }
      with AImage do begin
        ARect.TopLeft     := Point(0, 0);  
        ARect.BottomRight := Point(Width, Height);
      end;
      R2 := ARect;
      ARect := R2;  //这两句有什么用?有必要吗?
    {你看啊,它用的是变参,肯定要给回传了。}
    end;
      

  2.   

    Use ClipRect to determine where the canvas needs painting. ClipRect limits the drawing region of the canvas so that any drawing that occurs at coordinates outside the ClipRect is clipped and doesn抰 appear in the image.
    帮助文件中是这么写的..
    翻译就是:用ClipRect来决定画布重画的区域.............