Fill pies : Pie « 2D Graphics « VB.Net Tutorial






Fill pies
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms

public class DrawPieDemo
   public Shared Sub Main
        Application.Run(New FrmArcTest)
   End Sub
End class

Public Class FrmArcTest
   Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

   Public Sub New()
      MyBase.New()

      'This call is required by the Windows Form Designer.
      InitializeComponent()

      'Add any initialization after the InitializeComponent() call

   End Sub

   'Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
      If disposing Then
         If Not (components Is Nothing) Then
            components.Dispose()
         End If
      End If
      MyBase.Dispose(disposing)
   End Sub

   'Required by the Windows Form Designer
   Private components As System.ComponentModel.Container

   'NOTE: The following procedure is required by the Windows Form Designer
   'It can be modified using the Windows Form Designer.  
   'Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
      '
      'frmArcTest
      '
      Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
      Me.BackColor = System.Drawing.SystemColors.ControlLight
      Me.ClientSize = New System.Drawing.Size(292, 221)
      Me.Name = "frmArcTest"
      Me.Text = "Drawing Arcs"

   End Sub

#End Region

   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)

      ' start at 0 and sweep 360 degrees
      rectangle1.Location = New Point(15, 120)
      rectangle1.Size = New Size(80, 40)
      graphicsObject.FillPie(brush2, rectangle1, 0, 360)

      ' start at 270 and sweep -90 degrees
      rectangle1.Location = New Point(100, 120)
      graphicsObject.FillPie(brush2, rectangle1, 270, -90)

      ' start at 0 and sweep -270 degrees
      rectangle1.Location = New Point(185, 120)
      graphicsObject.FillPie(brush2, rectangle1, 0, -270)

   End Sub

End Class








17.8.Pie
17.8.1.Draw PieDraw Pie
17.8.2.Graphics.FillPieGraphics.FillPie
17.8.3.Drawing various pies on a formDrawing various pies on a form
17.8.4.Fill piesFill pies