Control.DrawToBitmap(Bitmap, Rectangle) 方法

定义

支持对指定位图的呈现。Supports rendering to the specified bitmap.

public:
 void DrawToBitmap(System::Drawing::Bitmap ^ bitmap, System::Drawing::Rectangle targetBounds);
public void DrawToBitmap (System.Drawing.Bitmap bitmap, System.Drawing.Rectangle targetBounds);
member this.DrawToBitmap : System.Drawing.Bitmap * System.Drawing.Rectangle -> unit

参数

bitmap
Bitmap

要绘制到的位图。The bitmap to be drawn to.

targetBounds
Rectangle

呈现控件时的边界。The bounds within which the control is rendered.

注解

ActiveX 控件不支持 DrawToBitmap 方法。The DrawToBitmap method is not supported for ActiveX controls. 可以重写 OnPrint 事件,并在需要时提供自定义打印逻辑。You can override the OnPrint event and provide custom printing logic if required.

DrawToBitmap 方法有以下限制:The DrawToBitmap method has the following limitations:

  • 对于大位图,可能会引发 ArgumentExceptionAn ArgumentException might be thrown for large bitmaps. 允许的最大大小因计算机而异。The maximum allowable size varies by machine.

  • DrawToBitmap 不支持 Windows XP Tablet PC Edition 2005 操作系统的 Ink 控件。DrawToBitmap does not support the Ink controls for the Windows XP Tablet PC Edition 2005 operating system.

  • 如果 TextBoxVisible 属性设置为 false,则 DrawToBitmap 不绘制子 TextBoxDrawToBitmap does not draw a child TextBox if the Visible property of the TextBox is set to false.

  • 容器内的控件按相反的顺序呈现。Controls inside containers are rendered in reverse order.

  • RichTextBoxDrawToBitmap 不完全正常运行;仅绘制位图的边框。DrawToBitmap is not fully functional for the RichTextBox; only the border of a bitmap is drawn.

适用于

另请参阅