Skip to content

Commit

Permalink
Merge pull request #189 from leocb/orapps44-patch-1
Browse files Browse the repository at this point in the history
Fix MaterialForm Left padding
  • Loading branch information
orapps44 authored Jun 15, 2021
2 parents f8d043b + 63be8ed commit 8b15243
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions MaterialSkin/Controls/MaterialForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ public FormStyles FormStyle
private const int STATUS_BAR_HEIGHT_DEFAULT = 24;
private int STATUS_BAR_HEIGHT = 24;
private const int ICON_SIZE = 24;
private const int PADDING_MINIMUM = 3;
private const int TITLE_LEFT_PADDING = 72;
private const int ACTION_BAR_PADDING = 16;
private const int ACTION_BAR_HEIGHT_DEFAULT = 40;
Expand Down Expand Up @@ -280,7 +281,7 @@ public MaterialForm()
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true);
FormStyle = FormStyles.ActionBar_40;

Padding = new Padding(3, STATUS_BAR_HEIGHT + ACTION_BAR_HEIGHT, 3, 3); //Keep space for resize by mouse
Padding = new Padding(PADDING_MINIMUM, STATUS_BAR_HEIGHT+ ACTION_BAR_HEIGHT, PADDING_MINIMUM, PADDING_MINIMUM); //Keep space for resize by mouse

// This enables the form to trigger the MouseMove event even when mouse is over another control
Application.AddMessageFilter(new MouseMessageFilter());
Expand Down Expand Up @@ -590,10 +591,10 @@ private void TerminateOnClose(object sender, FormClosedEventArgs e)

private void FixFormPadding(object sender)
{
if (drawerControl.ShowIconsWhenHidden &&
Padding.Left < drawerControl.MinWidth) Padding = new Padding(drawerControl.MinWidth, originalPadding.Top, originalPadding.Right, originalPadding.Bottom);
if (drawerControl.ShowIconsWhenHidden)
Padding = new Padding(Padding.Left < drawerControl.MinWidth ? drawerControl.MinWidth : Padding.Left, originalPadding.Top, originalPadding.Right, originalPadding.Bottom);
else
Padding = originalPadding;
Padding = new Padding(PADDING_MINIMUM, originalPadding.Top, originalPadding.Right, originalPadding.Bottom);
}

protected override void WndProc(ref Message m)
Expand Down Expand Up @@ -1122,7 +1123,7 @@ private void InitializeComponent()
this.ClientSize = new System.Drawing.Size(284, 261);
this.MinimumSize = new System.Drawing.Size(300, 200);
this.Name = "MaterialForm";
this.Padding = new System.Windows.Forms.Padding(3, 64, 3, 3);
this.Padding = new System.Windows.Forms.Padding(PADDING_MINIMUM, 64, PADDING_MINIMUM, PADDING_MINIMUM);
this.Load += new System.EventHandler(this.MaterialForm_Load);
this.ResumeLayout(false);
}
Expand Down

0 comments on commit 8b15243

Please sign in to comment.