X2021/Wardrobe/GUI.vb

53 lines
1.4 KiB
VB.net

Imports XCCLibrary
Public Class GUI
Public Shared Surface As Graphics
Public Shared line As Integer = 0
Public Shared point1 As Integer = 0
Public Shared point2 As Integer = 0
Public Shared point1p
Public Shared point2p
Public Shared mpos
Sub GUI_load() Handles MyBase.Load
Surface = CreateGraphics()
get_drawbox()
End Sub
Private Sub get_drawbox()
Dim DrawBox As Panel
DrawBox = Panel1
Dim locX, locY As Integer
locX = DrawBox.Location.X
locY = DrawBox.Location.Y
Dim boxW, boxH As Integer
boxW = DrawBox.Size.Width
boxH = DrawBox.Size.Height
Dim boxMidX, boxMidY As Integer
boxMidX = locX + boxW / 2
boxMidY = locY + boxH / 2
Dim pen As Pen = New Pen(Color.Red, 2)
Surface.DrawLine(pen, boxMidX, boxMidY, locX, locY)
End Sub
Private Sub mouse_cl(sender As Object, e As MouseEventArgs) Handles Me.MouseClick
mpos = e
If point1 = 0 And point2 = 0 Then
point1p = mpos
point1 = 1
ElseIf point1 = 1 And point2 = 0 Then
point2p = mpos
point2 = 1
Dim pen1 As Pen = New Pen(Color.Red, 2)
Surface.DrawLine(pen1, point1p.X, point1p.Y, point2p.X, point2p.Y)
point1 = 0
point2 = 0
End If
End Sub
End Class