Поделиться через


SimpleShape.DrawToBitmap - метод

Поддерживает отрисовку в указанном точечном рисунке.

Пространство имен:  Microsoft.VisualBasic.PowerPacks
Сборка:  Microsoft.VisualBasic.PowerPacks.Vs (в Microsoft.VisualBasic.PowerPacks.Vs.dll)

Синтаксис

'Декларация
Public Overrides Sub DrawToBitmap ( _
    bitmap As Bitmap, _
    targetBounds As Rectangle _
)
public override void DrawToBitmap(
    Bitmap bitmap,
    Rectangle targetBounds
)
public:
virtual void DrawToBitmap(
    Bitmap^ bitmap, 
    Rectangle targetBounds
) override
abstract DrawToBitmap : 
        bitmap:Bitmap * 
        targetBounds:Rectangle -> unit 
override DrawToBitmap : 
        bitmap:Bitmap * 
        targetBounds:Rectangle -> unit 
public override function DrawToBitmap(
    bitmap : Bitmap, 
    targetBounds : Rectangle
)

Параметры

Заметки

Если x OR y координаты или width OR height параметры targetBounds меньше 0 ArgumentException создает исключение.

Примеры

В следующем примере демонстрируется использование DrawToBitmap метод и ClientRectangle свойство для отрисовки OvalShape на a PictureBox элемент управления.

Private Sub Form1_Load() Handles MyBase.Load
    Dim pic As New System.Drawing.Bitmap(Me.PictureBox1.Image, 
      PictureBox1.Width, PictureBox1.Height)
    Dim rect As New System.Drawing.Rectangle
    ' Assign the client rectangle.
    rect = OvalShape1.ClientRectangle
    ' Draw the oval on the bitmap.
    OvalShape1.DrawToBitmap(pic, rect)
    PictureBox2.Image = pic
End Sub
private void form1_Load(System.Object sender, System.EventArgs e)
{
    System.Drawing.Bitmap pic = new System.Drawing.Bitmap(this.pictureBox1.Image, 
        pictureBox1.Width, pictureBox1.Height);
    System.Drawing.Rectangle rect = new System.Drawing.Rectangle();
    // Assign the client rectangle.
    rect = ovalShape1.ClientRectangle;
    // Draw the oval on the bitmap.
    ovalShape1.DrawToBitmap(pic, rect);
    pictureBox2.Image = pic;
}

Безопасность платформы .NET Framework

См. также

Ссылки

SimpleShape Класс

Microsoft.VisualBasic.PowerPacks - пространство имен

Другие ресурсы

Знакомство с элементами управления Line и Shape (Visual Studio)

Пошаговое руководство. Изображение линий при помощи элемента управления LineShape (Visual Studio)

Пошаговое руководство. Рисование фигур при помощи элементов управления OvalShape и RectangleShape (Visual Studio)