diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe index 68a80ae9..bf02be3d 100644 Binary files a/Bin/net40/SunnyUI.Demo.exe and b/Bin/net40/SunnyUI.Demo.exe differ diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index 0d589df5..8a791ce1 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/SunnyUI.dll b/Bin/net5.0-windows/SunnyUI.dll index c83acab5..966151e4 100644 Binary files a/Bin/net5.0-windows/SunnyUI.dll and b/Bin/net5.0-windows/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/ref/SunnyUI.dll b/Bin/net5.0-windows/ref/SunnyUI.dll index c65580e0..53825b89 100644 Binary files a/Bin/net5.0-windows/ref/SunnyUI.dll and b/Bin/net5.0-windows/ref/SunnyUI.dll differ diff --git a/Bin/netcoreapp3.1/SunnyUI.dll b/Bin/netcoreapp3.1/SunnyUI.dll index 77b481fe..61c4cf0a 100644 Binary files a/Bin/netcoreapp3.1/SunnyUI.dll and b/Bin/netcoreapp3.1/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Controls/FContextMenuStrip.Designer.cs b/SunnyUI.Demo/Controls/FContextMenuStrip.Designer.cs index 4d08dee7..ac317282 100644 --- a/SunnyUI.Demo/Controls/FContextMenuStrip.Designer.cs +++ b/SunnyUI.Demo/Controls/FContextMenuStrip.Designer.cs @@ -47,6 +47,7 @@ this.uiButton1.Cursor = System.Windows.Forms.Cursors.Hand; this.uiButton1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiButton1.Location = new System.Drawing.Point(30, 57); + this.uiButton1.MinimumSize = new System.Drawing.Size(1, 1); this.uiButton1.Name = "uiButton1"; this.uiButton1.Size = new System.Drawing.Size(232, 35); this.uiButton1.TabIndex = 0; @@ -56,13 +57,14 @@ // this.uiContextMenuStrip1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiContextMenuStrip1.Name = "uiContextMenuStrip1"; - this.uiContextMenuStrip1.Size = new System.Drawing.Size(61, 4); + this.uiContextMenuStrip1.Size = new System.Drawing.Size(181, 26); // // uiButton2 // this.uiButton2.Cursor = System.Windows.Forms.Cursors.Hand; this.uiButton2.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiButton2.Location = new System.Drawing.Point(294, 57); + this.uiButton2.MinimumSize = new System.Drawing.Size(1, 1); this.uiButton2.Name = "uiButton2"; this.uiButton2.Size = new System.Drawing.Size(232, 35); this.uiButton2.TabIndex = 1; diff --git a/SunnyUI/Controls/UINavBar.cs b/SunnyUI/Controls/UINavBar.cs index c74d473e..c87673ed 100644 --- a/SunnyUI/Controls/UINavBar.cs +++ b/SunnyUI/Controls/UINavBar.cs @@ -255,6 +255,7 @@ namespace Sunny.UI } [DefaultValue(null)] + [Browsable(false)] [Description("下拉菜单图片列表"), Category("SunnyUI")] public ImageList DropMenuImageList { @@ -505,10 +506,12 @@ namespace Sunny.UI NavBarMenu.Style = UIStyles.Style; NavBarMenu.Items.Clear(); + NavBarMenu.ImageList = ImageList; foreach (TreeNode node in Nodes[SelectedIndex].Nodes) { ToolStripMenuItem item = new ToolStripMenuItem(node.Text) { Tag = node }; item.Click += Item_Click; + if (ImageList != null) item.ImageIndex = node.ImageIndex; NavBarMenu.Items.Add(item); if (node.Nodes.Count > 0) @@ -528,13 +531,25 @@ namespace Sunny.UI { item.AutoSize = false; item.Width = NavBarMenu.Width - 1; - item.Height = 30; + + if (!DropDownItemAutoHeight) + { + item.Height = DropDownItemHeight; + } } NavBarMenu.CalcHeight(); NavBarMenu.Show(this, NodeMenuLeft(SelectedIndex), Height); } + [DefaultValue(30)] + [Description("下拉菜单节点高度"), Category("SunnyUI")] + public int DropDownItemHeight { get; set; } = 30; + + [DefaultValue(false)] + [Description("下拉菜单节点自动高度"), Category("SunnyUI")] + public bool DropDownItemAutoHeight { get; set; } = false; + private void Item_Click(object sender, EventArgs e) { ToolStripMenuItem item = (ToolStripMenuItem)sender; @@ -559,6 +574,7 @@ namespace Sunny.UI foreach (TreeNode childNode in node.Nodes) { ToolStripMenuItem childItem = new ToolStripMenuItem(childNode.Text) { Tag = childNode }; + if (ImageList != null) childItem.ImageIndex = childNode.ImageIndex; childItem.Click += Item_Click; item.DropDownItems.Add(childItem);