VB.Net by API/System.Windows.Forms/PaintEventArgs

Материал из VB Эксперт
Перейти к: навигация, поиск

PaintEventArgs.Graphics

   
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Drawing.Text
Public Class MainClass
   Shared Sub Main()
        Dim myform As Form = New FrmDrawing()
        Application.Run(myform)
   End Sub " Main
End Class
Public Class FrmDrawing
   Inherits System.Windows.Forms.Form
   Public Sub New()
      MyBase.New()
      Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
      Me.BackColor = System.Drawing.SystemColors.AppWorkspace
      Me.ClientSize = New System.Drawing.Size(472, 157)
   End Sub
   Protected Overrides Sub OnPaint(ByVal paintEvent As PaintEventArgs)
      Dim graphicsObject As Graphics = paintEvent.Graphics
      Dim rectangle1 As Rectangle = New Rectangle(15, 35, 80, 80)
      Dim brush1 As SolidBrush = New SolidBrush(Color.Firebrick)
      Dim pen1 As Pen = New Pen(brush1, 1)
      Dim brush2 As SolidBrush = New SolidBrush(Color.DarkBlue)
      Dim pen2 As Pen = New Pen(brush2, 1)
      rectangle1.Location = New Point(100, 35)
      graphicsObject.DrawRectangle(pen1, rectangle1)
      graphicsObject.DrawArc(pen2, rectangle1, 0, 110)
   End Sub
End Class