Skip to content

Commit

Permalink
button size fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stax76 committed Mar 8, 2021
1 parent 7390f53 commit 0a9e400
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Forms/MainForm.vb
Original file line number Diff line number Diff line change
Expand Up @@ -3742,7 +3742,7 @@ Public Class MainForm
l = ui.AddLabel("")

l = ui.AddLabel("Don't change Danger Zone settings unless you are" + BR +
"an absolute power user with debugging experience." + BR)
"a power user with debugging experience." + BR)

l.BackColor = ThemeManager.CurrentTheme.General.DangerBackColor
l.ForeColor = ThemeManager.CurrentTheme.General.DangerForeColor
Expand Down
12 changes: 6 additions & 6 deletions UI/Controls/Controls.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1796,13 +1796,15 @@ Namespace UI
End Get
Set(value As String)
_text = value

If AutoSize Then
Dim textSize = TextRenderer.MeasureText(_text, Font)
Dim fh = Font.Height
MinimumSize = New Size(fh * 2, CInt(fh * 1.9))
MinimumSize = New Size(CInt(fh * 2.2), fh)
AutoSizeMode = AutoSizeMode.GrowOnly
Size = New Size(textSize.Width + Padding.Horizontal + fh, textSize.Height + fh \ 2)
End If

Invalidate(True)
End Set
End Property
Expand Down Expand Up @@ -3088,15 +3090,13 @@ Namespace UI
Exit Sub
End If

SuspendLayout()
Try
If Not Disposing AndAlso Not IsDisposed Then
SuspendLayout()
BackgroundColor = theme.General.Controls.GridView.BackColor
ForeColor = theme.General.Controls.GridView.ForeColor
GridColor = theme.General.Controls.GridView.GridColor
Catch ex As Exception
Finally
ResumeLayout()
End Try
End If
End Sub

Function AddTextBoxColumn() As DataGridViewTextBoxColumn
Expand Down
13 changes: 10 additions & 3 deletions UI/Controls/SimpleUI.vb
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@ Public Class SimpleUI
Tree.Width = 0
Tree.Height = Height

Dim fh = FontHeight

If Tree.Nodes.Count > 1 Then
Tree.Width = (Aggregate i In Tree.GetNodes Into Max(i.Bounds.Right)) + FontHeight
Tree.Width = (Aggregate i In Tree.GetNodes Into Max(i.Bounds.Right)) + fh
End If

Host.Top = 0
Host.Left = Tree.Right + CInt(FontHeight / 3)
Host.Left = Tree.Right + CInt(fh / 3)
Host.Height = Height
Host.Width = Width - Tree.Width - CInt(FontHeight / 3)
Host.Width = Width - Tree.Width - CInt(fh / 3)

MyBase.OnLayout(levent)
End Sub
Expand Down Expand Up @@ -1052,6 +1054,10 @@ Public Class SimpleUI

Sub New(ui As SimpleUI)
MyBase.New(ui)
Button.AutoSizeMode = AutoSizeMode.GrowOnly
Button.AutoSize = True
Button.Font = New Font("Segoe UI", 9.0! * s.UIScaleFactor)
Button.Text = ""
Button.Height = CInt(Edit.Height / s.UIScaleFactor)
Button.Width = Button.Height
Button.ShowMenuSymbol = True
Expand Down Expand Up @@ -1176,6 +1182,7 @@ Public Class SimpleUI
MyBase.New(ui)
Button.AutoSizeMode = AutoSizeMode.GrowOnly
Button.AutoSize = True
Button.Font = New Font("Segoe UI", 9.0! * s.UIScaleFactor)
Button.Text = "..."
Controls.Add(Button)
AddHandler Edit.EnabledChanged, Sub() Button.Enabled = Edit.Enabled
Expand Down

0 comments on commit 0a9e400

Please sign in to comment.