93 lines
2.9 KiB
C#
93 lines
2.9 KiB
C#
|
// Decompiled with JetBrains decompiler
|
|||
|
// Type: CarotDAV.RightAlignToolStrip
|
|||
|
// Assembly: CarotDAV, Version=1.13.2.18337, Culture=neutral, PublicKeyToken=null
|
|||
|
// MVID: C31F2651-A4A8-4D09-916A-8C6106F5E7C8
|
|||
|
// Assembly location: F:\Eigene Dateien\Dropbox\portable Collection\Progs\CarotDAV\CarotDAV.exe
|
|||
|
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace CarotDAV
|
|||
|
{
|
|||
|
public class RightAlignToolStrip : ToolStrip
|
|||
|
{
|
|||
|
public RightAlignToolStrip()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public RightAlignToolStrip(params ToolStripItem[] items)
|
|||
|
: base(items)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
protected override void OnLayout(LayoutEventArgs e)
|
|||
|
{
|
|||
|
int num1 = this.DisplayRectangle.Width;
|
|||
|
int num2 = 0;
|
|||
|
if (num1 > 0)
|
|||
|
{
|
|||
|
int num3 = 0;
|
|||
|
int num4 = checked (this.Items.Count - 1);
|
|||
|
int index = num3;
|
|||
|
Padding padding;
|
|||
|
while (index <= num4)
|
|||
|
{
|
|||
|
if (this.Items[index].Visible)
|
|||
|
{
|
|||
|
int num5 = num1;
|
|||
|
padding = this.Items[index].Margin;
|
|||
|
int horizontal = padding.Horizontal;
|
|||
|
num1 = checked (num5 - horizontal);
|
|||
|
if ((this.Items[index].Anchor & AnchorStyles.Left) != AnchorStyles.None && (this.Items[index].Anchor & AnchorStyles.Right) != AnchorStyles.None)
|
|||
|
checked { ++num2; }
|
|||
|
else if (this.Items[index] is ToolStripTextBox)
|
|||
|
checked { ++num2; }
|
|||
|
else
|
|||
|
checked { num1 -= this.Items[index].Width; }
|
|||
|
}
|
|||
|
checked { ++index; }
|
|||
|
}
|
|||
|
if (this.OverflowButton.Visible)
|
|||
|
{
|
|||
|
int num5 = num1;
|
|||
|
padding = this.OverflowButton.Margin;
|
|||
|
int horizontal = padding.Horizontal;
|
|||
|
num1 = checked (num5 - horizontal - this.OverflowButton.Width);
|
|||
|
}
|
|||
|
int num6 = num1;
|
|||
|
padding = this.Padding;
|
|||
|
int horizontal1 = padding.Horizontal;
|
|||
|
num1 = checked (num6 - horizontal1 - 1);
|
|||
|
}
|
|||
|
if (num1 > 0 && num2 > 0)
|
|||
|
{
|
|||
|
int num3 = 0;
|
|||
|
int num4 = checked (this.Items.Count - 1);
|
|||
|
int index = num3;
|
|||
|
while (index <= num4)
|
|||
|
{
|
|||
|
if (this.Items[index].Visible)
|
|||
|
{
|
|||
|
this.Items[index].AutoSize = false;
|
|||
|
if ((this.Items[index].Anchor & AnchorStyles.Left) != AnchorStyles.None && (this.Items[index].Anchor & AnchorStyles.Right) != AnchorStyles.None)
|
|||
|
{
|
|||
|
this.Items[index].Width = num1 / num2;
|
|||
|
this.Items[index].Invalidate();
|
|||
|
checked { num1 -= this.Items[index].Width; }
|
|||
|
checked { --num2; }
|
|||
|
}
|
|||
|
else if (this.Items[index] is ToolStripTextBox)
|
|||
|
{
|
|||
|
this.Items[index].Width = num1 / num2;
|
|||
|
this.Items[index].Invalidate();
|
|||
|
checked { num1 -= this.Items[index].Width; }
|
|||
|
checked { --num2; }
|
|||
|
}
|
|||
|
}
|
|||
|
checked { ++index; }
|
|||
|
}
|
|||
|
}
|
|||
|
base.OnLayout(e);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|