因为需要在每个 tab 的右边显示关闭按钮,所以想到了在 tab 上面放一个 speedbutton 在 RzPageControl 的 DrawTabFace 函数中增加 代码如下:
  if FTabCloseButton <> nil then
  begin
    with FTabCloseButton do
    begin
      Parent := Self;
      Left := FaceRect.Right - 19;
      Top := FaceRect.Bottom - 20;
      Caption := '#';
      Self.Images.GetBitmap(0,Glyph);
      Show;
    end;
  end; 
编译通过,但是在使用的时候运行到如下代码报错      try
        // Fill the background of the tab (inside the region)
        DrawTabBackground( ATabIndex, ARect );
        // Draw the tab caption & image
        DrawTabFace( ATabIndex, ARect );
      finally
        // De-activate clipping region
        if RestoreDC( FBuffer.Canvas.Handle, -1 ) = WordBool( 0 ) then
          raise Exception.Create( sRzRestoringDCError );
      end;
请问 RestoreDC 起到什么作用?为什么我添加了第一段代码之后 RestoreDC 会报错?有什么办法解决?谢谢