From 2405176d74ee4a3acc086c0fadfd9dd5c168798a Mon Sep 17 00:00:00 2001 From: Anton Date: Mon, 25 Jan 2021 13:21:24 +0100 Subject: [PATCH] Small grapahic changes --- Wardrobe/GUI.Designer.vb | 70 +++++++++++++++++++++++++++------------- Wardrobe/GUI.vb | 27 +++++++++------- 2 files changed, 64 insertions(+), 33 deletions(-) diff --git a/Wardrobe/GUI.Designer.vb b/Wardrobe/GUI.Designer.vb index 7307279..27cd3be 100644 --- a/Wardrobe/GUI.Designer.vb +++ b/Wardrobe/GUI.Designer.vb @@ -28,30 +28,34 @@ Partial Class GUI 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.UpdateButton = New System.Windows.Forms.Button() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'DrawingPanel ' - Me.DrawingPanel.BackColor = System.Drawing.SystemColors.ActiveCaption - Me.DrawingPanel.Location = New System.Drawing.Point(561, 202) - Me.DrawingPanel.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2) + Me.DrawingPanel.BackColor = System.Drawing.SystemColors.Window + Me.DrawingPanel.Location = New System.Drawing.Point(239, 95) + Me.DrawingPanel.Margin = New System.Windows.Forms.Padding(2) Me.DrawingPanel.Name = "DrawingPanel" - Me.DrawingPanel.Size = New System.Drawing.Size(751, 338) + Me.DrawingPanel.Size = New System.Drawing.Size(649, 393) Me.DrawingPanel.TabIndex = 0 ' 'HeightBox ' - Me.HeightBox.Location = New System.Drawing.Point(640, 144) + Me.HeightBox.Location = New System.Drawing.Point(503, 51) + Me.HeightBox.Margin = New System.Windows.Forms.Padding(2) Me.HeightBox.Name = "HeightBox" - Me.HeightBox.Size = New System.Drawing.Size(100, 22) + Me.HeightBox.Size = New System.Drawing.Size(76, 20) Me.HeightBox.TabIndex = 1 ' 'WidthBox ' - Me.WidthBox.Location = New System.Drawing.Point(845, 144) + Me.WidthBox.Location = New System.Drawing.Point(343, 51) + Me.WidthBox.Margin = New System.Windows.Forms.Padding(2) Me.WidthBox.Name = "WidthBox" - Me.WidthBox.Size = New System.Drawing.Size(100, 22) + Me.WidthBox.Size = New System.Drawing.Size(76, 20) Me.WidthBox.TabIndex = 2 ' 'ContextMenuStrip1 @@ -60,28 +64,48 @@ Partial Class GUI Me.ContextMenuStrip1.Name = "ContextMenuStrip1" Me.ContextMenuStrip1.Size = New System.Drawing.Size(61, 4) ' - 'Button1 + 'UpdateButton ' - 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 + Me.UpdateButton.Location = New System.Drawing.Point(669, 51) + Me.UpdateButton.Margin = New System.Windows.Forms.Padding(2) + Me.UpdateButton.Name = "UpdateButton" + Me.UpdateButton.Size = New System.Drawing.Size(56, 19) + Me.UpdateButton.TabIndex = 3 + Me.UpdateButton.Text = "Update" + Me.UpdateButton.UseVisualStyleBackColor = True + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(303, 54) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(35, 13) + Me.Label1.TabIndex = 4 + Me.Label1.Text = "Width" + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(460, 54) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(38, 13) + Me.Label2.TabIndex = 5 + Me.Label2.Text = "Height" ' '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.ClientSize = New System.Drawing.Size(1324, 551) - Me.Controls.Add(Me.Button1) + Me.ClientSize = New System.Drawing.Size(899, 499) + Me.Controls.Add(Me.Label2) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.UpdateButton) 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.Text = "Floor Gratings" Me.ResumeLayout(False) Me.PerformLayout() @@ -91,5 +115,7 @@ Partial Class GUI Friend WithEvents HeightBox As TextBox Friend WithEvents WidthBox As TextBox Friend WithEvents ContextMenuStrip1 As ContextMenuStrip - Friend WithEvents Button1 As Button + Friend WithEvents UpdateButton As Button + Friend WithEvents Label1 As Label + Friend WithEvents Label2 As Label End Class diff --git a/Wardrobe/GUI.vb b/Wardrobe/GUI.vb index e051c8a..554d8c3 100644 --- a/Wardrobe/GUI.vb +++ b/Wardrobe/GUI.vb @@ -15,23 +15,25 @@ Public Class GUI AddHandler DrawBox.Paint, AddressOf DrawingPanel_Paint get_drawboxParameters() - set_startPoints() + set_startPointsX() + set_startPointsY() End Sub - Private Sub set_startPoints() + Private Sub set_startPointsX() p1X = boxMidX - CInt(DrawW / 2) - p1Y = boxMidY - CInt(DrawH / 2) p2X = boxMidX + CInt(DrawW / 2) - p2Y = boxMidY - CInt(DrawH / 2) p3X = boxMidX + CInt(DrawW / 2) - p3Y = boxMidY + CInt(DrawH / 2) p4X = boxMidX - CInt(DrawW / 2) + End Sub + + Private Sub set_startPointsY() + p1Y = boxMidY - CInt(DrawH / 2) + p2Y = boxMidY - CInt(DrawH / 2) + p3Y = boxMidY + CInt(DrawH / 2) p4Y = boxMidY + CInt(DrawH / 2) End Sub Private Sub get_drawboxParameters() - - boxX = DrawBox.Location.X 'Behövs ej boxY = DrawBox.Location.Y 'Behövs ej @@ -41,11 +43,10 @@ Public Class GUI boxMidX = boxW / 2 boxMidY = boxH / 2 - DrawW = boxW - 30 - DrawH = boxH - 30 + DrawW = boxW - 50 + DrawH = boxH - 50 Aspect1 = DrawW / DrawH - End Sub Private Sub DrawingPanel_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) @@ -56,7 +57,7 @@ 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 + Private Sub UpdateButton_Click(sender As Object, e As EventArgs) Handles UpdateButton.Click GratingH = HeightBox.Text GratingW = WidthBox.Text Aspect2 = GratingW / GratingH @@ -69,6 +70,8 @@ Public Class GUI p2Y = boxMidY - CInt(GratingH / (wDiff * 2)) p3Y = boxMidY + CInt(GratingH / (wDiff * 2)) p4Y = boxMidY + CInt(GratingH / (wDiff * 2)) + + set_startPointsX() Else 'Change draw width Dim hDiff As Double @@ -78,6 +81,8 @@ Public Class GUI p2X = boxMidX + CInt(GratingW / (hDiff * 2)) p3X = boxMidX + CInt(GratingW / (hDiff * 2)) p4X = boxMidX - CInt(GratingW / (hDiff * 2)) + + set_startPointsY() End If 'Redraw rectangle