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
Public Sub DrawToBitmap (bitmap As Bitmap, targetBounds As Rectangle)

参数

bitmap
Bitmap

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

targetBounds
Rectangle

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

注解

DrawToBitmapActiveX 控件不支持此方法。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:

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

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

  • DrawToBitmapTextBox如果 Visible 的属性 TextBox 设置为,则不绘制子级 falseDrawToBitmap 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.

  • DrawToBitmap 对于没有完全功能 RichTextBox ; 只绘制位图的边框。DrawToBitmap is not fully functional for the RichTextBox; only the border of a bitmap is drawn.

适用于

另请参阅