UINavMenu增加字体图标显示

This commit is contained in:
sunny 2020-05-27 16:46:59 +08:00
parent 6c132055b9
commit 3a765bcbdd
14 changed files with 61 additions and 38 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -117,6 +117,7 @@
//
// uiTextBox2
//
this.uiTextBox2.CanEmpty = true;
this.uiTextBox2.Cursor = System.Windows.Forms.Cursors.IBeam;
this.uiTextBox2.FillColor = System.Drawing.Color.White;
this.uiTextBox2.Font = new System.Drawing.Font("微软雅黑", 12F);
@ -128,8 +129,8 @@
this.uiTextBox2.Padding = new System.Windows.Forms.Padding(5);
this.uiTextBox2.Size = new System.Drawing.Size(221, 29);
this.uiTextBox2.TabIndex = 5;
this.uiTextBox2.Text = "0";
this.uiTextBox2.Type = Sunny.UI.UITextBox.UIEditType.Integer;
this.uiTextBox2.Watermark = "水印文字";
//
// uiLabel3
//

View File

@ -81,7 +81,7 @@
this.uiAvatar.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiAvatar.Location = new System.Drawing.Point(943, 25);
this.uiAvatar.Name = "uiAvatar";
this.uiAvatar.Size = new System.Drawing.Size(65, 61);
this.uiAvatar.Size = new System.Drawing.Size(65, 65);
this.uiAvatar.TabIndex = 4;
this.uiAvatar.Text = "uiAvatar1";
//

View File

@ -11,31 +11,33 @@ namespace Sunny.UI.Demo
int pageIndex = 1000;
Header.SetNodePageIndex(Header.Nodes[0], pageIndex);
TreeNode parent = Aside.CreateNode("Controls", pageIndex);
Aside.CreateChildNode(parent, AddPage(new FButton(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FLabel(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FCheckBox(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FRadioButton(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FTextBox(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FDataGridView(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FListBox(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FTreeView(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FNavigation(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FTabControl(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FLine(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FPanel(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FTransfer(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FAvatar(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FContextMenuStrip(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FMeter(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FOther(), ++pageIndex));
Header.SetNodeSymbol(Header.Nodes[0], 61451, 24);
TreeNode parent = Aside.CreateNode("Controls", 61451, 24, pageIndex);
Aside.CreateChildNode(parent, 61640, 24, AddPage(new FButton(), ++pageIndex));
Aside.CreateChildNode(parent, 61490, 24, AddPage(new FLabel(), ++pageIndex));
Aside.CreateChildNode(parent, 61770, 24, AddPage(new FCheckBox(), ++pageIndex));
Aside.CreateChildNode(parent, 61842, 24, AddPage(new FRadioButton(), ++pageIndex));
Aside.CreateChildNode(parent, 61962, 24, AddPage(new FTextBox(), ++pageIndex));
Aside.CreateChildNode(parent, 61646, 24, AddPage(new FDataGridView(), ++pageIndex));
Aside.CreateChildNode(parent, 61474, 24, AddPage(new FListBox(), ++pageIndex));
Aside.CreateChildNode(parent, 61499, 24, AddPage(new FTreeView(), ++pageIndex));
Aside.CreateChildNode(parent, 61912, 24, AddPage(new FNavigation(), ++pageIndex));
Aside.CreateChildNode(parent, 61716, 24, AddPage(new FTabControl(), ++pageIndex));
Aside.CreateChildNode(parent, 61544, 24, AddPage(new FLine(), ++pageIndex));
Aside.CreateChildNode(parent, 61590, 24, AddPage(new FPanel(), ++pageIndex));
Aside.CreateChildNode(parent, 61516, 24, AddPage(new FTransfer(), ++pageIndex));
Aside.CreateChildNode(parent, 61447, 24, AddPage(new FAvatar(), ++pageIndex));
Aside.CreateChildNode(parent, 62104, 24, AddPage(new FContextMenuStrip(), ++pageIndex));
Aside.CreateChildNode(parent, 61668, 24, AddPage(new FMeter(), ++pageIndex));
Aside.CreateChildNode(parent, 62173, 24, AddPage(new FOther(), ++pageIndex));
pageIndex = 2000;
Header.SetNodePageIndex(Header.Nodes[1], pageIndex);
parent = Aside.CreateNode("Forms", pageIndex);
Aside.CreateChildNode(parent, AddPage(new FDialogs(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FEditor(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FFrames(), ++pageIndex));
Header.SetNodeSymbol(Header.Nodes[1], 61818, 24);
parent = Aside.CreateNode("Forms", 61818, 24, pageIndex);
Aside.CreateChildNode(parent, 62160, 24, AddPage(new FDialogs(), ++pageIndex));
Aside.CreateChildNode(parent, 61508, 24, AddPage(new FEditor(), ++pageIndex));
Aside.CreateChildNode(parent, 61674, 24, AddPage(new FFrames(), ++pageIndex));
var styles = UIStyles.PopularStyles();
foreach (UIStyle style in styles)

View File

@ -69,6 +69,16 @@ namespace Sunny.UI
MenuHelper.SetPageIndex(node, pageIndex);
}
public void SetNodeSymbol(TreeNode node, int symbol, int symbolSize = 24)
{
MenuHelper.SetSymbol(node, symbol, symbolSize);
}
public void SetNodeImageIndex(TreeNode node, int imageIndex)
{
node.ImageIndex = imageIndex;
}
[DefaultValue(null)]
public string TagString { get; set; }

View File

@ -353,6 +353,11 @@ namespace Sunny.UI
MenuHelper.SetSymbol(node, symbol, symbolSize);
}
public void SetNodeImageIndex(TreeNode node, int imageIndex)
{
node.ImageIndex = imageIndex;
}
protected override void OnDrawNode(DrawTreeNodeEventArgs e)
{
if (BorderStyle != BorderStyle.None)

View File

@ -59,13 +59,21 @@ namespace Sunny.UI
while (AwesomeLabels.Count > 0)
{
if (AwesomeLabels.TryDequeue(out Label lbl))
{
lpAwesome.Controls.Add(lbl);
int symbol = (int)lbl.Tag;
toolTip.SetToolTip(lbl, symbol.ToString());
}
}
while (ElegantLabels.Count > 0)
{
if (ElegantLabels.TryDequeue(out Label lbl))
{
lpElegant.Controls.Add(lbl);
int symbol = (int)lbl.Tag;
toolTip.SetToolTip(lbl, symbol.ToString());
}
}
timer.Start();
@ -192,22 +200,14 @@ namespace Sunny.UI
private void AddLabel(int icon)
{
lpCustom.Controls.Add(CreateLabel(icon));
Label lbl = CreateLabel(icon);
lpCustom.Controls.Add(lbl);
int symbol = (int)lbl.Tag;
toolTip.SetToolTip(lbl, symbol.ToString());
}
// public readonly KeyScopes AwesomeScore = new KeyScopes();
// public readonly KeyScopes ElegantScore = new KeyScopes();
//
// private int scoreStep = 0;
private Label CreateLabel(int icon)
{
// if (scoreStep == 0)
// AwesomeScore.Add(icon);
// if (scoreStep == 1)
// ElegantScore.Add(icon);
Label lbl = new Label();
lbl.AutoSize = false;
lbl.Size = new Size(32, 32);

View File

@ -38,6 +38,7 @@
this.lpElegant = new System.Windows.Forms.FlowLayoutPanel();
this.bg = new System.ComponentModel.BackgroundWorker();
this.timer = new System.Windows.Forms.Timer(this.components);
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
@ -129,7 +130,6 @@
//
// UIFontImages
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(497, 450);
this.Controls.Add(this.tabControl1);
@ -156,5 +156,6 @@
private System.Windows.Forms.FlowLayoutPanel lpElegant;
private System.ComponentModel.BackgroundWorker bg;
private System.Windows.Forms.Timer timer;
private System.Windows.Forms.ToolTip toolTip;
}
}

View File

@ -123,4 +123,7 @@
<metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>162, 24</value>
</metadata>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>245, 24</value>
</metadata>
</root>

View File

@ -83,7 +83,7 @@ namespace Sunny.UI
return ShowMessageDialog(msg, UILocalize.AskTitle, true, style);
}
private static bool ShowMessageDialog(string message, string title, bool isShowCancel, UIStyle style)
public static bool ShowMessageDialog(string message, string title, bool isShowCancel, UIStyle style)
{
UIMessageForm frm = new UIMessageForm();
frm.ShowMessage(message, title, isShowCancel, style);

View File

@ -3,6 +3,7 @@
2020.05.27
* 更新UIListBox消息处理Bug
* 更新页面框架Main命名继承关系为Private。继承后编译时删除Design.cs里面Main部分
+ UINavMenuÔö¼Ó×ÖÌåͼ±êÏÔʾ
2020.05.26
* 更新页面框架Main叠放次序