Visual Basic ile Grafik
Grafik Nesneler DrawArcYay çizer DrawBezierKübik kapalı eğri çizer DrawBeziersKübik kapalı eğriler serisi çizer DrawClosedCurve Tanımlanan dizi noktaları kullanılarak kapalı eğriler çizer DrawCurveTanımlanan dizi noktaları kullanılarak eğriler çizer DrawEllipseElips veya Çember çizer DrawImageBir nesne çizer(resim) DrawLineÇizgi çizer DrawPathGraphicsPath tarafından belirlenen eğri ve çizgiler çizer DrawPiePasta dilimi çizer DrawPolygonBir poligon çokgen çizer DrawRectangleDikdörtgen çizer DrawStringMetin çizer
Grafik Nesneler FillEllipseSınırları belirlenmiş bir elipsin içini boyar FillPathBelirlenen yolun içini boyar FillPiePasta diliminin içini boyar FillPolygonDizi noktaları tarafından belirlenmiş çokgenin içini boyar FillRectangleDikdörtgenin içini boyar FillRectanglesDikdörtgenler serisinin içini boyar FillRegionBir bölgenin içini boyar
DrawLine Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint Dim g As Graphics = e.Graphics Dim pn As New Pen(Color.Blue, 5) Dim pnt1 As New Point(10, 10) Dim pnt2 As New Point(100, 100) g.DrawLine(pn, pnt1, pnt2) End Sub
DrawEllipse Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint Dim g As Graphics = e.Graphics Dim pen As New Drawing.Pen(System.Drawing.Color.Red, 5) Me.CreateGraphics.DrawEllipse(pen, 10, 10, 100, 100) pen.Dispose() End Sub
DrawString Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint Dim g As Graphics = e.Graphics Dim pen As New Drawing.Pen(System.Drawing.Color.Red, 5) Me.CreateGraphics.DrawEllipse(pen, 10, 10, 100, 100) pen.Dispose() Me.CreateGraphics.DrawString("Şekil ismi", New Font("Arial", 12, FontStyle.Bold.Underline), Brushes.Black, 12, 50) End Sub
DrawPie Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint Dim g As Graphics = e.Graphics Dim pen As New Drawing.Pen(System.Drawing.Color.Red, 5) Me.CreateGraphics.DrawPie(pen, 5, 5, 200, 200, 0, -90) pen.Dispose() Me.CreateGraphics.DrawString("Yay", New Font("Arial", 12, FontStyle.Bold.Underline), Brushes.Black, 110, 50) End Sub
MouseUp Mouse ile tıklanan yere çember çizimi : Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs) Dim pen As New Drawing.Pen(System.Drawing.Color.Red, 5) Me.CreateGraphics.DrawEllipse(pen, e.X, e.Y, 50, 50) Me.CreateGraphics.DrawEllipse(pen, e.X-25, e.Y-25, 50, 50) pen.Dispose() End Sub
HatchBrush, FillRectangle Imports System.Drawing.Drawing2D Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) Dim g As Graphics = e.Graphics Dim firca1 As New HatchBrush(HatchStyle.DarkHorizontal, Color.Tomato) Dim alan1 As New Rectangle(0, 0, Me.Width, 50) g.FillRectangle(firca1, alan1) End Sub