修复combobox的padding值自动累加问题
This commit is contained in:
parent
c015e40db4
commit
e281b51b4c
@ -269,6 +269,10 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
protected override void OnPaddingChanged(EventArgs e)
|
protected override void OnPaddingChanged(EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (Padding.Right < 30 || Padding.Bottom < 2)
|
||||||
|
{
|
||||||
|
Padding = new Padding(Padding.Left, Padding.Top, Padding.Right < 30 ? 30 : Padding.Right, Padding.Bottom < 2 ? 2 : Padding.Bottom);
|
||||||
|
}
|
||||||
base.OnPaddingChanged(e);
|
base.OnPaddingChanged(e);
|
||||||
SizeChange();
|
SizeChange();
|
||||||
}
|
}
|
||||||
@ -282,7 +286,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
edit.Top = (Height - edit.Height) / 2;
|
edit.Top = (Height - edit.Height) / 2;
|
||||||
edit.Left = 3 + Padding.Left;
|
edit.Left = 3 + Padding.Left;
|
||||||
edit.Width = Width - 30 - Padding.Left - Padding.Right;
|
edit.Width = Width - Padding.Left - Padding.Right;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnPaintFore(Graphics g, GraphicsPath path)
|
protected override void OnPaintFore(Graphics g, GraphicsPath path)
|
||||||
@ -296,7 +300,6 @@ namespace Sunny.UI
|
|||||||
g.DrawRoundRectangle(rectColor, new Rectangle(0, 0, Width, Height), Radius, true);
|
g.DrawRoundRectangle(rectColor, new Rectangle(0, 0, Width, Height), Radius, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Padding = new Padding(Padding.Left, 0, 30 + Padding.Right, 2);
|
|
||||||
g.FillRoundRectangle(GetFillColor(), new Rectangle(Width - 27, edit.Top, 25, edit.Height), Radius);
|
g.FillRoundRectangle(GetFillColor(), new Rectangle(Width - 27, edit.Top, 25, edit.Height), Radius);
|
||||||
Color color = GetRectColor();
|
Color color = GetRectColor();
|
||||||
SizeF sf = g.GetFontImageSize(dropSymbol, 24);
|
SizeF sf = g.GetFontImageSize(dropSymbol, 24);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user