* UISymbolButton:修改可设置Padding控制图标垂直方向的显示位置
This commit is contained in:
parent
1f653fb053
commit
94a441c9f7
Binary file not shown.
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
4
SunnyUI/Controls/UIDoubleUpDown.designer.cs
generated
4
SunnyUI/Controls/UIDoubleUpDown.designer.cs
generated
@ -43,7 +43,7 @@
|
||||
this.btnDec.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.btnDec.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnDec.Name = "btnDec";
|
||||
this.btnDec.Padding = new System.Windows.Forms.Padding(26, 0, 0, 0);
|
||||
this.btnDec.Padding = new System.Windows.Forms.Padding(26, 4, 0, 0);
|
||||
this.btnDec.RadiusSides = ((Sunny.UI.UICornerRadiusSides)((Sunny.UI.UICornerRadiusSides.LeftTop | Sunny.UI.UICornerRadiusSides.LeftBottom)));
|
||||
this.btnDec.Size = new System.Drawing.Size(29, 29);
|
||||
this.btnDec.Symbol = 61544;
|
||||
@ -61,7 +61,7 @@
|
||||
this.btnAdd.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.btnAdd.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnAdd.Name = "btnAdd";
|
||||
this.btnAdd.Padding = new System.Windows.Forms.Padding(26, 0, 0, 0);
|
||||
this.btnAdd.Padding = new System.Windows.Forms.Padding(26, 3, 0, 0);
|
||||
this.btnAdd.RadiusSides = ((Sunny.UI.UICornerRadiusSides)((Sunny.UI.UICornerRadiusSides.RightTop | Sunny.UI.UICornerRadiusSides.RightBottom)));
|
||||
this.btnAdd.Size = new System.Drawing.Size(29, 29);
|
||||
this.btnAdd.Symbol = 61543;
|
||||
|
4
SunnyUI/Controls/UIIntegerUpDown.designer.cs
generated
4
SunnyUI/Controls/UIIntegerUpDown.designer.cs
generated
@ -43,7 +43,7 @@
|
||||
this.btnDec.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.btnDec.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnDec.Name = "btnDec";
|
||||
this.btnDec.Padding = new System.Windows.Forms.Padding(26, 0, 0, 0);
|
||||
this.btnDec.Padding = new System.Windows.Forms.Padding(26, 4, 0, 0);
|
||||
this.btnDec.RadiusSides = ((Sunny.UI.UICornerRadiusSides)((Sunny.UI.UICornerRadiusSides.LeftTop | Sunny.UI.UICornerRadiusSides.LeftBottom)));
|
||||
this.btnDec.Size = new System.Drawing.Size(29, 29);
|
||||
this.btnDec.Symbol = 61544;
|
||||
@ -61,7 +61,7 @@
|
||||
this.btnAdd.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.btnAdd.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnAdd.Name = "btnAdd";
|
||||
this.btnAdd.Padding = new System.Windows.Forms.Padding(26, 0, 0, 0);
|
||||
this.btnAdd.Padding = new System.Windows.Forms.Padding(26, 3, 0, 0);
|
||||
this.btnAdd.RadiusSides = ((Sunny.UI.UICornerRadiusSides)((Sunny.UI.UICornerRadiusSides.RightTop | Sunny.UI.UICornerRadiusSides.RightBottom)));
|
||||
this.btnAdd.Size = new System.Drawing.Size(29, 29);
|
||||
this.btnAdd.Symbol = 61543;
|
||||
|
@ -166,6 +166,12 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaddingChanged(EventArgs e)
|
||||
{
|
||||
base.OnPaddingChanged(e);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
//重绘父类
|
||||
@ -195,14 +201,18 @@ namespace Sunny.UI
|
||||
if (Symbol > 0 && Image == null)
|
||||
{
|
||||
e.Graphics.DrawFontImage(Symbol, SymbolSize, color,
|
||||
new RectangleF((Width - ImageSize.Width) / 2.0f, (Height - ImageSize.Height) / 2.0f,
|
||||
ImageSize.Width, ImageSize.Height));
|
||||
new RectangleF(
|
||||
(Width - ImageSize.Width) / 2.0f,
|
||||
Padding.Top + (Height - ImageSize.Height - Padding.Top - Padding.Bottom) / 2.0f,
|
||||
ImageSize.Width, ImageSize.Height));
|
||||
}
|
||||
|
||||
if (Image != null)
|
||||
{
|
||||
e.Graphics.DrawImage(Image, (Width - Image.Width) / 2.0f, (Height - Image.Height) / 2.0f,
|
||||
ImageSize.Width, ImageSize.Height);
|
||||
e.Graphics.DrawImage(Image,
|
||||
(Width - ImageSize.Width) / 2.0f,
|
||||
Padding.Top + (Height - ImageSize.Height - Padding.Top - Padding.Bottom) / 2.0f,
|
||||
ImageSize.Width, ImageSize.Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user