* UILabel:增加文字旋转角度
This commit is contained in:
parent
639b04a24c
commit
45fad139bc
Binary file not shown.
Binary file not shown.
16
SunnyUI.Demo/Controls/FCombobox.Designer.cs
generated
16
SunnyUI.Demo/Controls/FCombobox.Designer.cs
generated
@ -97,7 +97,6 @@ namespace Sunny.UI.Demo
|
||||
this.uiDatePicker3 = new Sunny.UI.UIDatePicker();
|
||||
this.uiLine4 = new Sunny.UI.UILine();
|
||||
this.uiComboDataGridView1 = new Sunny.UI.UIComboDataGridView();
|
||||
this.uiButton1 = new Sunny.UI.UIButton();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// uiComboTreeView3
|
||||
@ -144,7 +143,6 @@ namespace Sunny.UI.Demo
|
||||
this.uiComboTreeView3.Size = new System.Drawing.Size(150, 29);
|
||||
this.uiComboTreeView3.TabIndex = 67;
|
||||
this.uiComboTreeView3.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.uiComboTreeView3.NodesSelected += new Sunny.UI.UIComboTreeView.OnNodesSelected(this.uiComboTreeView3_NodesSelected);
|
||||
//
|
||||
// uiComboTreeView4
|
||||
//
|
||||
@ -505,24 +503,11 @@ namespace Sunny.UI.Demo
|
||||
this.uiComboDataGridView1.SelectIndexChange += new Sunny.UI.UIDataGridView.OnSelectIndexChange(this.uiComboDataGridView1_SelectIndexChange_1);
|
||||
this.uiComboDataGridView1.ValueChanged += new Sunny.UI.UIComboDataGridView.OnValueChanged(this.uiComboDataGridView1_ValueChanged);
|
||||
//
|
||||
// uiButton1
|
||||
//
|
||||
this.uiButton1.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiButton1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.uiButton1.Location = new System.Drawing.Point(384, 439);
|
||||
this.uiButton1.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiButton1.Name = "uiButton1";
|
||||
this.uiButton1.Size = new System.Drawing.Size(100, 35);
|
||||
this.uiButton1.TabIndex = 75;
|
||||
this.uiButton1.Text = "uiButton1";
|
||||
this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click);
|
||||
//
|
||||
// FCombobox
|
||||
//
|
||||
this.AllowShowTitle = true;
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.ClientSize = new System.Drawing.Size(765, 522);
|
||||
this.Controls.Add(this.uiButton1);
|
||||
this.Controls.Add(this.uiComboDataGridView1);
|
||||
this.Controls.Add(this.uiLine4);
|
||||
this.Controls.Add(this.uiDatePicker3);
|
||||
@ -573,6 +558,5 @@ namespace Sunny.UI.Demo
|
||||
private UIDatePicker uiDatePicker3;
|
||||
private UILine uiLine4;
|
||||
private UIComboDataGridView uiComboDataGridView1;
|
||||
private UIButton uiButton1;
|
||||
}
|
||||
}
|
@ -105,16 +105,6 @@ namespace Sunny.UI.Demo
|
||||
}
|
||||
}
|
||||
|
||||
private void uiComboTreeView3_NodesSelected(object sender, TreeNodeCollection nodes)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void uiButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
uiComboBox1.ShowDropDown();
|
||||
}
|
||||
|
||||
private void uiComboDataGridView1_ValueChanged(object sender, object value)
|
||||
{
|
||||
if (value is DataGridViewRow row)
|
||||
|
56
SunnyUI.Demo/Controls/FLabel.Designer.cs
generated
56
SunnyUI.Demo/Controls/FLabel.Designer.cs
generated
@ -41,6 +41,10 @@ namespace Sunny.UI.Demo
|
||||
this.uiLine1 = new Sunny.UI.UILine();
|
||||
this.uiLinkLabel1 = new Sunny.UI.UILinkLabel();
|
||||
this.uiLabel1 = new Sunny.UI.UILabel();
|
||||
this.uiLabel2 = new Sunny.UI.UILabel();
|
||||
this.uiLabel3 = new Sunny.UI.UILabel();
|
||||
this.uiLabel4 = new Sunny.UI.UILabel();
|
||||
this.uiLine5 = new Sunny.UI.UILine();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// uiMarkLabel4
|
||||
@ -191,11 +195,59 @@ namespace Sunny.UI.Demo
|
||||
this.uiLabel1.Text = "Hello world!";
|
||||
this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// uiLabel2
|
||||
//
|
||||
this.uiLabel2.Angle = 270;
|
||||
this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiLabel2.Location = new System.Drawing.Point(38, 297);
|
||||
this.uiLabel2.Name = "uiLabel2";
|
||||
this.uiLabel2.Size = new System.Drawing.Size(43, 126);
|
||||
this.uiLabel2.TabIndex = 46;
|
||||
this.uiLabel2.Text = "Angle=270°";
|
||||
this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// uiLabel3
|
||||
//
|
||||
this.uiLabel3.Angle = 90;
|
||||
this.uiLabel3.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiLabel3.Location = new System.Drawing.Point(90, 304);
|
||||
this.uiLabel3.Name = "uiLabel3";
|
||||
this.uiLabel3.Size = new System.Drawing.Size(43, 126);
|
||||
this.uiLabel3.TabIndex = 47;
|
||||
this.uiLabel3.Text = "Angle=90°";
|
||||
this.uiLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// uiLabel4
|
||||
//
|
||||
this.uiLabel4.Angle = 315;
|
||||
this.uiLabel4.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiLabel4.Location = new System.Drawing.Point(160, 297);
|
||||
this.uiLabel4.Name = "uiLabel4";
|
||||
this.uiLabel4.Size = new System.Drawing.Size(103, 126);
|
||||
this.uiLabel4.TabIndex = 48;
|
||||
this.uiLabel4.Text = "Angle=315°";
|
||||
this.uiLabel4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// uiLine5
|
||||
//
|
||||
this.uiLine5.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiLine5.Location = new System.Drawing.Point(30, 290);
|
||||
this.uiLine5.MinimumSize = new System.Drawing.Size(16, 16);
|
||||
this.uiLine5.Name = "uiLine5";
|
||||
this.uiLine5.Size = new System.Drawing.Size(319, 20);
|
||||
this.uiLine5.TabIndex = 49;
|
||||
this.uiLine5.Text = "UILabel(旋转角度)";
|
||||
this.uiLine5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// FLabel
|
||||
//
|
||||
this.AllowShowTitle = true;
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.uiLine5);
|
||||
this.Controls.Add(this.uiLabel4);
|
||||
this.Controls.Add(this.uiLabel3);
|
||||
this.Controls.Add(this.uiLabel2);
|
||||
this.Controls.Add(this.uiMarkLabel4);
|
||||
this.Controls.Add(this.uiMarkLabel3);
|
||||
this.Controls.Add(this.uiMarkLabel2);
|
||||
@ -231,5 +283,9 @@ namespace Sunny.UI.Demo
|
||||
private UILine uiLine1;
|
||||
private UILinkLabel uiLinkLabel1;
|
||||
private UILabel uiLabel1;
|
||||
private UILabel uiLabel2;
|
||||
private UILabel uiLabel3;
|
||||
private UILabel uiLabel4;
|
||||
private UILine uiLine5;
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
* 2020-01-01: V2.2.0 增加文件说明
|
||||
* 2020-04-23: V2.2.4 增加UISymbolLabel
|
||||
* 2020-04-25: V2.2.4 更新主题配置类
|
||||
* 2020-11-12: V3.0.8 增加文字旋转角度
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -41,6 +42,19 @@ namespace Sunny.UI
|
||||
ForeColorChanged += UILabel_ForeColorChanged;
|
||||
}
|
||||
|
||||
private int angle;
|
||||
|
||||
[DefaultValue(0),Category("SunnyUI"),Description("居中时旋转角度")]
|
||||
public int Angle
|
||||
{
|
||||
get => angle;
|
||||
set
|
||||
{
|
||||
angle = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public bool IsScaled { get; private set; }
|
||||
|
||||
@ -121,6 +135,18 @@ namespace Sunny.UI
|
||||
base.OnForeColorChanged(e);
|
||||
_style = UIStyle.Custom;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
if (TextAlign == ContentAlignment.MiddleCenter && Angle != 0 && !AutoSize)
|
||||
{
|
||||
e.Graphics.DrawStringRotateAtCenter(Text, Font, ForeColor, this.ClientRectangle.Center(), Angle);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnPaint(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[ToolboxItem(true)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user