Rectangel drawn
This commit is contained in:
parent
5921ba4b84
commit
e2a4da65ed
|
|
@ -29,19 +29,19 @@ Partial Class GUI
|
||||||
'DrawingPanel
|
'DrawingPanel
|
||||||
'
|
'
|
||||||
Me.DrawingPanel.BackColor = System.Drawing.SystemColors.ActiveCaption
|
Me.DrawingPanel.BackColor = System.Drawing.SystemColors.ActiveCaption
|
||||||
Me.DrawingPanel.Location = New System.Drawing.Point(277, 138)
|
Me.DrawingPanel.Location = New System.Drawing.Point(90, 41)
|
||||||
|
Me.DrawingPanel.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
|
||||||
Me.DrawingPanel.Name = "DrawingPanel"
|
Me.DrawingPanel.Name = "DrawingPanel"
|
||||||
Me.DrawingPanel.Size = New System.Drawing.Size(751, 339)
|
Me.DrawingPanel.Size = New System.Drawing.Size(563, 275)
|
||||||
Me.DrawingPanel.TabIndex = 0
|
Me.DrawingPanel.TabIndex = 0
|
||||||
'
|
'
|
||||||
'GUI
|
'GUI
|
||||||
'
|
'
|
||||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
|
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||||
Me.ClientSize = New System.Drawing.Size(1324, 552)
|
Me.ClientSize = New System.Drawing.Size(993, 448)
|
||||||
Me.Controls.Add(Me.DrawingPanel)
|
Me.Controls.Add(Me.DrawingPanel)
|
||||||
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
|
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
|
||||||
Me.Margin = New System.Windows.Forms.Padding(4)
|
|
||||||
Me.Name = "GUI"
|
Me.Name = "GUI"
|
||||||
Me.Text = "Build a wardrobe"
|
Me.Text = "Build a wardrobe"
|
||||||
Me.ResumeLayout(False)
|
Me.ResumeLayout(False)
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
Public Class GUI
|
Public Class GUI
|
||||||
Dim DrawBox As Panel
|
Dim DrawBox As Panel
|
||||||
Dim boxX, boxY, boxW, boxH, boxMidX, boxMidY As Integer
|
Dim boxX, boxY, boxW, boxH, boxMidX, boxMidY As Integer
|
||||||
|
Dim gratingW, gratingH As Integer
|
||||||
|
|
||||||
|
|
||||||
Sub GUI_load() Handles MyBase.Load
|
Sub GUI_load() Handles MyBase.Load
|
||||||
DrawBox = DrawingPanel
|
DrawBox = DrawingPanel
|
||||||
|
|
@ -12,19 +14,35 @@ Public Class GUI
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub get_drawboxParameters()
|
Private Sub get_drawboxParameters()
|
||||||
boxX = DrawBox.Location.X
|
boxX = DrawBox.Location.X 'Behövs ej
|
||||||
boxY = DrawBox.Location.Y
|
boxY = DrawBox.Location.Y 'Behövs ej
|
||||||
|
|
||||||
boxW = DrawBox.Size.Width
|
boxW = DrawBox.Size.Width
|
||||||
boxH = DrawBox.Size.Height
|
boxH = DrawBox.Size.Height
|
||||||
|
|
||||||
boxMidX = boxX + boxW / 2
|
boxMidX = boxW / 2
|
||||||
boxMidY = boxY + boxH / 2
|
boxMidY = boxH / 2
|
||||||
|
|
||||||
|
gratingW = boxW - 30
|
||||||
|
gratingH = boxH - 30
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub DrawingPanel_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs)
|
Private Sub DrawingPanel_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs)
|
||||||
|
Dim p1X As Integer = boxMidX - CInt(gratingW / 2)
|
||||||
|
Dim p1Y As Integer = boxMidY - CInt(gratingH / 2)
|
||||||
|
Dim p2X As Integer = boxMidX + CInt(gratingW / 2)
|
||||||
|
Dim p2Y As Integer = boxMidY - CInt(gratingH / 2)
|
||||||
|
Dim p3X As Integer = boxMidX + CInt(gratingW / 2)
|
||||||
|
Dim p3Y As Integer = boxMidY + CInt(gratingH / 2)
|
||||||
|
Dim p4X As Integer = boxMidX - CInt(gratingW / 2)
|
||||||
|
Dim p4Y As Integer = boxMidY + CInt(gratingH / 2)
|
||||||
|
|
||||||
|
|
||||||
Dim pen As Pen = New Pen(Color.Red, 2)
|
Dim pen As Pen = New Pen(Color.Red, 2)
|
||||||
e.Graphics.DrawLine(pen, boxMidX, boxMidY, boxMidX + 1, boxMidY + 1)
|
e.Graphics.DrawLine(pen, p1X, p1Y, p2X, p2Y)
|
||||||
|
e.Graphics.DrawLine(pen, p2X, p2Y, p3X, p3Y)
|
||||||
|
e.Graphics.DrawLine(pen, p3X, p3Y, p4X, p4Y)
|
||||||
|
e.Graphics.DrawLine(pen, p4X, p4Y, p1X, p1Y)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue