This commit is contained in:
Mans 2021-01-25 12:45:20 +01:00
parent e2a4da65ed
commit dd9f8d6617
3 changed files with 82 additions and 16 deletions

View File

@ -22,31 +22,74 @@ Partial Class GUI
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(GUI))
Me.DrawingPanel = New System.Windows.Forms.Panel()
Me.HeightBox = New System.Windows.Forms.TextBox()
Me.WidthBox = New System.Windows.Forms.TextBox()
Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'DrawingPanel
'
Me.DrawingPanel.BackColor = System.Drawing.SystemColors.ActiveCaption
Me.DrawingPanel.Location = New System.Drawing.Point(90, 41)
Me.DrawingPanel.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
Me.DrawingPanel.Location = New System.Drawing.Point(561, 202)
Me.DrawingPanel.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2)
Me.DrawingPanel.Name = "DrawingPanel"
Me.DrawingPanel.Size = New System.Drawing.Size(563, 275)
Me.DrawingPanel.Size = New System.Drawing.Size(751, 338)
Me.DrawingPanel.TabIndex = 0
'
'HeightBox
'
Me.HeightBox.Location = New System.Drawing.Point(640, 144)
Me.HeightBox.Name = "HeightBox"
Me.HeightBox.Size = New System.Drawing.Size(100, 22)
Me.HeightBox.TabIndex = 1
'
'WidthBox
'
Me.WidthBox.Location = New System.Drawing.Point(845, 144)
Me.WidthBox.Name = "WidthBox"
Me.WidthBox.Size = New System.Drawing.Size(100, 22)
Me.WidthBox.TabIndex = 2
'
'ContextMenuStrip1
'
Me.ContextMenuStrip1.ImageScalingSize = New System.Drawing.Size(20, 20)
Me.ContextMenuStrip1.Name = "ContextMenuStrip1"
Me.ContextMenuStrip1.Size = New System.Drawing.Size(61, 4)
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(1074, 152)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 23)
Me.Button1.TabIndex = 3
Me.Button1.Text = "Button1"
Me.Button1.UseVisualStyleBackColor = True
'
'GUI
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(993, 448)
Me.ClientSize = New System.Drawing.Size(1324, 551)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.WidthBox)
Me.Controls.Add(Me.HeightBox)
Me.Controls.Add(Me.DrawingPanel)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Margin = New System.Windows.Forms.Padding(4)
Me.Name = "GUI"
Me.Text = "Build a wardrobe"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents DrawingPanel As Panel
Friend WithEvents HeightBox As TextBox
Friend WithEvents WidthBox As TextBox
Friend WithEvents ContextMenuStrip1 As ContextMenuStrip
Friend WithEvents Button1 As Button
End Class

View File

@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View File

@ -3,7 +3,10 @@
Public Class GUI
Dim DrawBox As Panel
Dim boxX, boxY, boxW, boxH, boxMidX, boxMidY As Integer
Dim gratingW, gratingH As Integer
Dim GratingW, GratingH As Double
Dim DrawW, DrawH As Integer
Dim Aspect1, Aspect2 As Double
Sub GUI_load() Handles MyBase.Load
@ -14,6 +17,8 @@ Public Class GUI
End Sub
Private Sub get_drawboxParameters()
boxX = DrawBox.Location.X 'Behövs ej
boxY = DrawBox.Location.Y 'Behövs ej
@ -23,19 +28,23 @@ Public Class GUI
boxMidX = boxW / 2
boxMidY = boxH / 2
gratingW = boxW - 30
gratingH = boxH - 30
DrawW = boxW - 30
DrawH = boxH - 30
Aspect1 = DrawW / DrawH
End Sub
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 p1X As Integer = boxMidX - CInt(DrawW / 2)
Dim p1Y As Integer = boxMidY - CInt(DrawH / 2)
Dim p2X As Integer = boxMidX + CInt(DrawW / 2)
Dim p2Y As Integer = boxMidY - CInt(DrawH / 2)
Dim p3X As Integer = boxMidX + CInt(DrawW / 2)
Dim p3Y As Integer = boxMidY + CInt(DrawH / 2)
Dim p4X As Integer = boxMidX - CInt(DrawW / 2)
Dim p4Y As Integer = boxMidY + CInt(DrawH / 2)
Dim pen As Pen = New Pen(Color.Red, 2)
@ -45,4 +54,15 @@ Public Class GUI
e.Graphics.DrawLine(pen, p4X, p4Y, p1X, p1Y)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
GratingH = HeightBox.Text
GratingW = WidthBox.Text
Aspect2 = GratingW / GratingH
If Aspect2 > Aspect1 Then
'Change draw height
Else
End If
End Sub
End Class