Author Topic: Drawing in VB  (Read 4095 times)

0 Members and 1 Guest are viewing this topic.

Offline Code.Illusionist

  • Royal Highness
  • ****
  • Posts: 687
  • Cookies: 39
  • Compile or die trying
    • View Profile
Drawing in VB
« on: December 08, 2012, 12:17:20 am »
I am learning some basics about drawing in VB and it's going quite good. I understand how to create a pen, how to draw a line, rectangle, triangle , polygon etc. But there is one thing I just can't understand. How the x and y coordinates work? I have code like this:
Code: (vb) [Select]
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim grafika As Graphics = Me.CreateGraphics
        Dim A As New Point(10, 10)
        Dim B As New Point(10, 100)
        Dim C As New Point(100, 10)
        Dim D As New Point(100, 100)
        Dim tacke As Point() = {A, B, C, D}
        Dim olovka As Pen = New Pen(Brushes.Black, 3)
        grafika.DrawPolygon(olovka, tacke)
    End Sub
End Class
But, don't understand why I get that shape, I wanted to be something else, like Square, doesen't mather. I know it can be done with rectangle but wanted to use point for practice.
« Last Edit: December 08, 2012, 12:36:03 am by Code.Illusionist »
Vae Victis - suffering to the conquered