全新界面,引入Menu+Tabs形式显示示例

This commit is contained in:
czz_y 2025-01-15 17:06:57 +08:00
parent d76d262152
commit 5f5e6603f4
10 changed files with 266 additions and 148 deletions

111
MainWindow.Designer.cs generated
View File

@ -29,13 +29,21 @@
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow));
AntdUI.Tabs.StyleCard styleCard2 = new AntdUI.Tabs.StyleCard();
this.titlebar = new AntdUI.PageHeader(); this.titlebar = new AntdUI.PageHeader();
this.input_search = new AntdUI.Input(); this.input_search = new AntdUI.Input();
this.button_color = new AntdUI.Button(); this.button_color = new AntdUI.Button();
this.buttonSZ = new AntdUI.Button(); this.buttonSZ = new AntdUI.Button();
this.menu = new AntdUI.Menu(); this.pageHeader1 = new AntdUI.PageHeader();
this.button_collapse = new AntdUI.Button();
this.tabs = new AntdUI.Tabs();
this.tabPage = new AntdUI.TabPage();
this.panel_content = new AntdUI.Panel(); this.panel_content = new AntdUI.Panel();
this.menu = new AntdUI.Menu();
this.titlebar.SuspendLayout(); this.titlebar.SuspendLayout();
this.pageHeader1.SuspendLayout();
this.tabs.SuspendLayout();
this.tabPage.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// titlebar // titlebar
@ -46,11 +54,11 @@
this.titlebar.DividerShow = true; this.titlebar.DividerShow = true;
this.titlebar.Dock = System.Windows.Forms.DockStyle.Top; this.titlebar.Dock = System.Windows.Forms.DockStyle.Top;
this.titlebar.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.titlebar.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.titlebar.Location = new System.Drawing.Point(6, 0); this.titlebar.Location = new System.Drawing.Point(0, 0);
this.titlebar.Name = "titlebar"; this.titlebar.Name = "titlebar";
this.titlebar.ShowButton = true; this.titlebar.ShowButton = true;
this.titlebar.ShowIcon = true; this.titlebar.ShowIcon = true;
this.titlebar.Size = new System.Drawing.Size(1018, 40); this.titlebar.Size = new System.Drawing.Size(1024, 40);
this.titlebar.SubText = "Demo 1.8.3"; this.titlebar.SubText = "Demo 1.8.3";
this.titlebar.TabIndex = 0; this.titlebar.TabIndex = 0;
this.titlebar.Text = "AntdUI"; this.titlebar.Text = "AntdUI";
@ -60,7 +68,7 @@
this.input_search.AllowClear = true; this.input_search.AllowClear = true;
this.input_search.Dock = System.Windows.Forms.DockStyle.Right; this.input_search.Dock = System.Windows.Forms.DockStyle.Right;
this.input_search.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F); this.input_search.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F);
this.input_search.Location = new System.Drawing.Point(574, 0); this.input_search.Location = new System.Drawing.Point(580, 0);
this.input_search.Name = "input_search"; this.input_search.Name = "input_search";
this.input_search.PlaceholderText = "输入关键字搜索..."; this.input_search.PlaceholderText = "输入关键字搜索...";
this.input_search.PrefixSvg = "SearchOutlined"; this.input_search.PrefixSvg = "SearchOutlined";
@ -73,7 +81,7 @@
this.button_color.Ghost = true; this.button_color.Ghost = true;
this.button_color.IconRatio = 0.6F; this.button_color.IconRatio = 0.6F;
this.button_color.IconSvg = resources.GetString("button_color.IconSvg"); this.button_color.IconSvg = resources.GetString("button_color.IconSvg");
this.button_color.Location = new System.Drawing.Point(774, 0); this.button_color.Location = new System.Drawing.Point(780, 0);
this.button_color.Name = "button_color"; this.button_color.Name = "button_color";
this.button_color.Radius = 0; this.button_color.Radius = 0;
this.button_color.Size = new System.Drawing.Size(50, 40); this.button_color.Size = new System.Drawing.Size(50, 40);
@ -85,49 +93,104 @@
this.buttonSZ.Dock = System.Windows.Forms.DockStyle.Right; this.buttonSZ.Dock = System.Windows.Forms.DockStyle.Right;
this.buttonSZ.Ghost = true; this.buttonSZ.Ghost = true;
this.buttonSZ.IconSvg = resources.GetString("buttonSZ.IconSvg"); this.buttonSZ.IconSvg = resources.GetString("buttonSZ.IconSvg");
this.buttonSZ.Location = new System.Drawing.Point(824, 0); this.buttonSZ.Location = new System.Drawing.Point(830, 0);
this.buttonSZ.Name = "buttonSZ"; this.buttonSZ.Name = "buttonSZ";
this.buttonSZ.Radius = 0; this.buttonSZ.Radius = 0;
this.buttonSZ.Size = new System.Drawing.Size(50, 40); this.buttonSZ.Size = new System.Drawing.Size(50, 40);
this.buttonSZ.TabIndex = 0; this.buttonSZ.TabIndex = 0;
this.buttonSZ.WaveSize = 0; this.buttonSZ.WaveSize = 0;
// //
// menu // pageHeader1
// //
this.menu.AutoCollapse = true; this.pageHeader1.Controls.Add(this.button_collapse);
this.menu.Dock = System.Windows.Forms.DockStyle.Left; this.pageHeader1.DividerShow = true;
this.menu.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.pageHeader1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.menu.Indent = true; this.pageHeader1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.menu.Location = new System.Drawing.Point(6, 40); this.pageHeader1.Location = new System.Drawing.Point(0, 600);
this.menu.Name = "menu"; this.pageHeader1.Name = "pageHeader1";
this.menu.Size = new System.Drawing.Size(277, 594); this.pageHeader1.Size = new System.Drawing.Size(1024, 40);
this.menu.TabIndex = 1; this.pageHeader1.TabIndex = 7;
this.menu.Unique = true; //
// button_collapse
//
this.button_collapse.Dock = System.Windows.Forms.DockStyle.Left;
this.button_collapse.Ghost = true;
this.button_collapse.IconRatio = 0.6F;
this.button_collapse.IconSvg = "MenuUnfoldOutlined";
this.button_collapse.Location = new System.Drawing.Point(0, 0);
this.button_collapse.Name = "button_collapse";
this.button_collapse.Radius = 0;
this.button_collapse.Size = new System.Drawing.Size(50, 40);
this.button_collapse.TabIndex = 3;
this.button_collapse.ToggleIconSvg = "MenuFoldOutlined";
this.button_collapse.WaveSize = 0;
//
// tabs
//
this.tabs.Cursor = System.Windows.Forms.Cursors.Default;
this.tabs.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabs.Gap = 20;
this.tabs.Location = new System.Drawing.Point(50, 40);
this.tabs.Name = "tabs";
this.tabs.Pages.Add(this.tabPage);
this.tabs.Size = new System.Drawing.Size(974, 560);
styleCard2.Closable = true;
this.tabs.Style = styleCard2;
this.tabs.TabIndex = 9;
this.tabs.Type = AntdUI.TabType.Card;
//
// tabPage
//
this.tabPage.Controls.Add(this.panel_content);
this.tabPage.IconSvg = "HomeOutlined";
this.tabPage.Location = new System.Drawing.Point(3, 40);
this.tabPage.Name = "tabPage";
this.tabPage.ReadOnly = true;
this.tabPage.Size = new System.Drawing.Size(968, 517);
this.tabPage.TabIndex = 1;
this.tabPage.Text = "首页";
// //
// panel_content // panel_content
// //
this.panel_content.Back = System.Drawing.Color.Transparent; this.panel_content.Back = System.Drawing.Color.Transparent;
this.panel_content.Dock = System.Windows.Forms.DockStyle.Fill; this.panel_content.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel_content.Location = new System.Drawing.Point(283, 40); this.panel_content.Location = new System.Drawing.Point(0, 0);
this.panel_content.Name = "panel_content"; this.panel_content.Name = "panel_content";
this.panel_content.Radius = 0; this.panel_content.Radius = 0;
this.panel_content.Size = new System.Drawing.Size(741, 594); this.panel_content.Size = new System.Drawing.Size(968, 517);
this.panel_content.TabIndex = 2; this.panel_content.TabIndex = 4;
//
// menu
//
this.menu.Collapsed = true;
this.menu.Dock = System.Windows.Forms.DockStyle.Left;
this.menu.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.menu.IconRatio = 1F;
this.menu.Indent = true;
this.menu.Location = new System.Drawing.Point(0, 40);
this.menu.Name = "menu";
this.menu.Padding = new System.Windows.Forms.Padding(6);
this.menu.Size = new System.Drawing.Size(50, 560);
this.menu.TabIndex = 8;
this.menu.Unique = true;
// //
// MainWindow // MainWindow
// //
this.ClientSize = new System.Drawing.Size(1024, 640); this.ClientSize = new System.Drawing.Size(1024, 640);
this.ControlBox = false; this.ControlBox = false;
this.Controls.Add(this.panel_content); this.Controls.Add(this.tabs);
this.Controls.Add(this.menu); this.Controls.Add(this.menu);
this.Controls.Add(this.pageHeader1);
this.Controls.Add(this.titlebar); this.Controls.Add(this.titlebar);
this.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "MainWindow"; this.Name = "MainWindow";
this.Padding = new System.Windows.Forms.Padding(6, 0, 0, 6);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "AntdUI Demo"; this.Text = "AntdUI Demo";
this.titlebar.ResumeLayout(false); this.titlebar.ResumeLayout(false);
this.pageHeader1.ResumeLayout(false);
this.tabs.ResumeLayout(false);
this.tabPage.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -135,10 +198,14 @@
#endregion #endregion
private AntdUI.PageHeader titlebar; private AntdUI.PageHeader titlebar;
private AntdUI.Menu menu;
private AntdUI.Button buttonSZ; private AntdUI.Button buttonSZ;
private AntdUI.Button button_color; private AntdUI.Button button_color;
private AntdUI.Input input_search; private AntdUI.Input input_search;
private AntdUI.PageHeader pageHeader1;
private AntdUI.Button button_collapse;
private AntdUI.Tabs tabs;
private AntdUI.TabPage tabPage;
private AntdUI.Panel panel_content; private AntdUI.Panel panel_content;
private AntdUI.Menu menu;
} }
} }

View File

@ -12,7 +12,7 @@ namespace AntdUIDemo
{ {
public partial class MainWindow : AntdUI.Window public partial class MainWindow : AntdUI.Window
{ {
private UserControl control; private UserControl currControl;
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
@ -28,7 +28,7 @@ namespace AntdUIDemo
private void InitData() private void InitData()
{ {
control = new Wellcome { Dock = DockStyle.Fill }; UserControl control = new Wellcome { Dock = DockStyle.Fill };
AutoDpi(control); AutoDpi(control);
panel_content.Controls.Add(control); panel_content.Controls.Add(control);
} }
@ -39,10 +39,25 @@ namespace AntdUIDemo
button_color.Click += Button_color_Click; button_color.Click += Button_color_Click;
input_search.TextChanged += Input_search_textchanged; input_search.TextChanged += Input_search_textchanged;
menu.SelectChanged += Menu_SelectChanged; menu.SelectChanged += Menu_SelectChanged;
button_collapse.Click += button_collapse_Click;
//监听系统深浅色变化 //监听系统深浅色变化
SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged; SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
} }
private void button_collapse_Click(object sender, EventArgs e)
{
if (menu.Collapsed)
{
menu.Width = (int)(250 * Config.Dpi);
}
else
{
menu.Width = (int)(50 * Config.Dpi);
}
button_collapse.Toggle = !button_collapse.Toggle;
menu.Collapsed = !menu.Collapsed;
}
private void Input_search_textchanged(object sender, EventArgs e) private void Input_search_textchanged(object sender, EventArgs e)
{ {
titlebar.Loading = true; titlebar.Loading = true;
@ -134,7 +149,7 @@ namespace AntdUIDemo
foreach (var rootItem in DataUtil.MenuItems) foreach (var rootItem in DataUtil.MenuItems)
{ {
var rootKey = rootItem.Key.ToLower(); var rootKey = rootItem.Key.ToLower();
var rootMenu = new AntdUI.MenuItem { Text = rootItem.Key }; var rootMenu = new AntdUI.MenuItem { Text = rootItem.Key, IconSvg = DataUtil.MenuIcons.TryGetValue(rootItem.Key, out var icon) ? icon : "UnorderedListOutlined" };
bool rootVisible = false; // 用于标记是否显示根节点 bool rootVisible = false; // 用于标记是否显示根节点
foreach (var item in rootItem.Value) foreach (var item in rootItem.Value)
@ -165,17 +180,27 @@ namespace AntdUIDemo
private void Menu_SelectChanged(object sender, MenuSelectEventArgs e) private void Menu_SelectChanged(object sender, MenuSelectEventArgs e)
{ {
var name = e.Value.Tag; string name = (string)e.Value.Tag;
if (control != null)
// 如果上一个组件是 FloatButtonDemo清理其浮动按钮窗体
if (currControl is FloatButtonDemo floatButtonDemo)
{ {
if (control is FloatButtonDemo floatButtonDemo) floatButtonDemo.CloseFloatButtonForm();
{
floatButtonDemo.CloseFloatButtonForm(); // 清理浮动按钮窗体
}
control?.Dispose();
control = null;
} }
panel_content.Controls.Clear();
// 检查是否已存在同名 TabPage
foreach (var tab in tabs.Pages)
{
if (tab is AntdUI.TabPage existingTab && existingTab.Text == name)
{
tabs.SelectedTab = existingTab; // 直接跳转到已存在的 TabPage
currControl = existingTab.Controls.Count > 0 ? existingTab.Controls[0] as UserControl : null;
return;
}
}
// 如果不存在相应的 TabPage创建新的
UserControl control = null;
switch (name) switch (name)
{ {
case "Button": case "Button":
@ -360,7 +385,13 @@ namespace AntdUIDemo
//容器添加控件需要调整dpi //容器添加控件需要调整dpi
control.Dock = DockStyle.Fill; control.Dock = DockStyle.Fill;
AutoDpi(control); AutoDpi(control);
panel_content.Controls.Add(control); AntdUI.TabPage tabPage = new AntdUI.TabPage() {
Text = name,
};
tabPage.Controls.Add(control);
tabs.Pages.Add(tabPage);
tabs.SelectedTab = tabPage;
currControl = control;
} }
} }
} }

View File

@ -20,7 +20,7 @@ namespace AntdUIDemo.Models
new MenuItems { Text = "GridPanel 网格布局", Tag = "GridPanel"}, new MenuItems { Text = "GridPanel 网格布局", Tag = "GridPanel"},
new MenuItems { Text = "Panel 面板", Tag = "Panel"}, new MenuItems { Text = "Panel 面板", Tag = "Panel"},
new MenuItems { Text = "StackPanel 堆叠布局", Tag = "StackPanel"}, new MenuItems { Text = "StackPanel 堆叠布局", Tag = "StackPanel"},
new MenuItems { Text = "VirtualPanel 虚拟布局", Tag = "VirtualPanel"} //new MenuItems { Text = "VirtualPanel 虚拟布局", Tag = "VirtualPanel"}
} }
}, },
{ "导航", new List<MenuItems> { "导航", new List<MenuItems>
@ -98,6 +98,21 @@ namespace AntdUIDemo.Models
} }
} }
}; };
public static readonly Dictionary<string, string> MenuIcons = new Dictionary<string, string>
{
{ "通用", "AppstoreOutlined" },
{ "布局", "LayoutOutlined" },
{ "导航", "CompressOutlined" },
{ "数据录入", "EditOutlined" },
{ "数据展示", "BarChartOutlined" },
{ "反馈", "NotificationOutlined" },
{ "聊天", "MessageOutlined" },
{ "其它", "SettingOutlined" }
};
} }
} }

View File

@ -17,6 +17,7 @@ namespace AntdUIDemo
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
AntdUI.Localization.DefaultLanguage = "zh-CN"; AntdUI.Localization.DefaultLanguage = "zh-CN";
//若文字不清晰,切换其他渲染方式
AntdUI.Config.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; AntdUI.Config.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
AntdUI.Config.SetCorrectionTextRendering("Microsoft YaHei UI"); AntdUI.Config.SetCorrectionTextRendering("Microsoft YaHei UI");

View File

@ -33,6 +33,7 @@
- ✅ 支持显示/隐藏滚动条 - ✅ 支持显示/隐藏滚动条
- ✅ 支持设置 Message/Notification 消息显示位置 - ✅ 支持设置 Message/Notification 消息显示位置
![SystemSet](assets/screenshots/Demo.png)
![SystemSet](assets/screenshots/SystemSet.png) ![SystemSet](assets/screenshots/SystemSet.png)
## 控件演示 ## 控件演示
@ -56,7 +57,6 @@
![Panel](assets/screenshots/Panel.png) ![Panel](assets/screenshots/Panel.png)
#### StackPanel 堆叠布局 #### StackPanel 堆叠布局
![StackPanel](assets/screenshots/StackPanel.png) ![StackPanel](assets/screenshots/StackPanel.png)
#### VirtualPanel 虚拟布局
### 导航 ### 导航
#### Breadcrumb 面包屑 #### Breadcrumb 面包屑

View File

@ -30,7 +30,15 @@
{ {
this.header1 = new AntdUI.PageHeader(); this.header1 = new AntdUI.PageHeader();
this.stackPanel1 = new AntdUI.StackPanel(); this.stackPanel1 = new AntdUI.StackPanel();
this.stackPanel2 = new AntdUI.StackPanel();
this.stackPanel8 = new AntdUI.StackPanel();
this.switch_enabled = new AntdUI.Switch();
this.label18 = new AntdUI.Label();
this.colorPicker = new AntdUI.ColorPicker();
this.label16 = new AntdUI.Label();
this.stackPanel6 = new AntdUI.StackPanel(); this.stackPanel6 = new AntdUI.StackPanel();
this.switch_loading = new AntdUI.Switch();
this.label2 = new AntdUI.Label();
this.input_badgesize = new AntdUI.InputNumber(); this.input_badgesize = new AntdUI.InputNumber();
this.label15 = new AntdUI.Label(); this.label15 = new AntdUI.Label();
this.input_badge = new AntdUI.Input(); this.input_badge = new AntdUI.Input();
@ -62,24 +70,17 @@
this.label10 = new AntdUI.Label(); this.label10 = new AntdUI.Label();
this.label4 = new AntdUI.Label(); this.label4 = new AntdUI.Label();
this.label3 = new AntdUI.Label(); this.label3 = new AntdUI.Label();
this.stackPanel8 = new AntdUI.StackPanel(); this.buttonOpen = new AntdUI.Button();
this.stackPanel2 = new AntdUI.StackPanel();
this.buttonCZ = new AntdUI.Button(); this.buttonCZ = new AntdUI.Button();
this.buttonClose = new AntdUI.Button(); this.buttonClose = new AntdUI.Button();
this.colorPicker = new AntdUI.ColorPicker();
this.label16 = new AntdUI.Label();
this.switch_loading = new AntdUI.Switch();
this.label2 = new AntdUI.Label();
this.switch_enabled = new AntdUI.Switch();
this.label18 = new AntdUI.Label();
this.stackPanel1.SuspendLayout(); this.stackPanel1.SuspendLayout();
this.stackPanel2.SuspendLayout();
this.stackPanel8.SuspendLayout();
this.stackPanel6.SuspendLayout(); this.stackPanel6.SuspendLayout();
this.stackPanel5.SuspendLayout(); this.stackPanel5.SuspendLayout();
this.stackPanel7.SuspendLayout(); this.stackPanel7.SuspendLayout();
this.stackPanel4.SuspendLayout(); this.stackPanel4.SuspendLayout();
this.stackPanel3.SuspendLayout(); this.stackPanel3.SuspendLayout();
this.stackPanel8.SuspendLayout();
this.stackPanel2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// header1 // header1
@ -115,6 +116,67 @@
this.stackPanel1.Text = "stackPanel1"; this.stackPanel1.Text = "stackPanel1";
this.stackPanel1.Vertical = true; this.stackPanel1.Vertical = true;
// //
// stackPanel2
//
this.stackPanel2.Controls.Add(this.buttonCZ);
this.stackPanel2.Controls.Add(this.buttonClose);
this.stackPanel2.Controls.Add(this.buttonOpen);
this.stackPanel2.Location = new System.Drawing.Point(3, 291);
this.stackPanel2.Name = "stackPanel2";
this.stackPanel2.Size = new System.Drawing.Size(744, 38);
this.stackPanel2.TabIndex = 28;
this.stackPanel2.Text = "stackPanel2";
//
// stackPanel8
//
this.stackPanel8.Controls.Add(this.switch_enabled);
this.stackPanel8.Controls.Add(this.label18);
this.stackPanel8.Controls.Add(this.colorPicker);
this.stackPanel8.Controls.Add(this.label16);
this.stackPanel8.Gap = 4;
this.stackPanel8.Location = new System.Drawing.Point(3, 253);
this.stackPanel8.Name = "stackPanel8";
this.stackPanel8.Size = new System.Drawing.Size(744, 32);
this.stackPanel8.TabIndex = 27;
this.stackPanel8.Text = "stackPanel8";
//
// switch_enabled
//
this.switch_enabled.Location = new System.Drawing.Point(292, 3);
this.switch_enabled.Name = "switch_enabled";
this.switch_enabled.Size = new System.Drawing.Size(50, 26);
this.switch_enabled.TabIndex = 32;
this.switch_enabled.Text = "switch1";
//
// label18
//
this.label18.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label18.Location = new System.Drawing.Point(190, 3);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(92, 26);
this.label18.TabIndex = 31;
this.label18.Text = "Enabled";
//
// colorPicker
//
this.colorPicker.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.colorPicker.Location = new System.Drawing.Point(105, 3);
this.colorPicker.Name = "colorPicker";
this.colorPicker.Size = new System.Drawing.Size(75, 26);
this.colorPicker.TabIndex = 30;
this.colorPicker.Text = "colorPicker1";
this.colorPicker.Value = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(119)))), ((int)(((byte)(255)))));
this.colorPicker.WaveSize = 0;
//
// label16
//
this.label16.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label16.Location = new System.Drawing.Point(3, 3);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(92, 26);
this.label16.TabIndex = 29;
this.label16.Text = "BadgeBack";
//
// stackPanel6 // stackPanel6
// //
this.stackPanel6.Controls.Add(this.switch_loading); this.stackPanel6.Controls.Add(this.switch_loading);
@ -130,6 +192,23 @@
this.stackPanel6.TabIndex = 25; this.stackPanel6.TabIndex = 25;
this.stackPanel6.Text = "stackPanel6"; this.stackPanel6.Text = "stackPanel6";
// //
// switch_loading
//
this.switch_loading.Location = new System.Drawing.Point(492, 3);
this.switch_loading.Name = "switch_loading";
this.switch_loading.Size = new System.Drawing.Size(50, 26);
this.switch_loading.TabIndex = 30;
this.switch_loading.Text = "switch1";
//
// label2
//
this.label2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(390, 3);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(92, 26);
this.label2.TabIndex = 29;
this.label2.Text = "Loading";
//
// input_badgesize // input_badgesize
// //
this.input_badgesize.DecimalPlaces = 2; this.input_badgesize.DecimalPlaces = 2;
@ -195,7 +274,6 @@
// //
// switch_round // switch_round
// //
this.switch_round.AutoCheck = true;
this.switch_round.Location = new System.Drawing.Point(492, 3); this.switch_round.Location = new System.Drawing.Point(492, 3);
this.switch_round.Name = "switch_round"; this.switch_round.Name = "switch_round";
this.switch_round.Size = new System.Drawing.Size(50, 26); this.switch_round.Size = new System.Drawing.Size(50, 26);
@ -325,7 +403,6 @@
// //
// switch_topmost // switch_topmost
// //
this.switch_topmost.AutoCheck = true;
this.switch_topmost.Checked = true; this.switch_topmost.Checked = true;
this.switch_topmost.Location = new System.Drawing.Point(492, 3); this.switch_topmost.Location = new System.Drawing.Point(492, 3);
this.switch_topmost.Name = "switch_topmost"; this.switch_topmost.Name = "switch_topmost";
@ -417,7 +494,6 @@
// //
// switch_vertical // switch_vertical
// //
this.switch_vertical.AutoCheck = true;
this.switch_vertical.Checked = true; this.switch_vertical.Checked = true;
this.switch_vertical.Location = new System.Drawing.Point(492, 3); this.switch_vertical.Location = new System.Drawing.Point(492, 3);
this.switch_vertical.Name = "switch_vertical"; this.switch_vertical.Name = "switch_vertical";
@ -502,36 +578,24 @@
this.label3.TabIndex = 4; this.label3.TabIndex = 4;
this.label3.Text = "FloatButton没有工具箱控件使用代码方式调用。"; this.label3.Text = "FloatButton没有工具箱控件使用代码方式调用。";
// //
// stackPanel8 // buttonOpen
// //
this.stackPanel8.Controls.Add(this.switch_enabled); this.buttonOpen.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.stackPanel8.Controls.Add(this.label18); this.buttonOpen.Location = new System.Drawing.Point(3, 3);
this.stackPanel8.Controls.Add(this.colorPicker); this.buttonOpen.Name = "buttonOpen";
this.stackPanel8.Controls.Add(this.label16); this.buttonOpen.Size = new System.Drawing.Size(75, 32);
this.stackPanel8.Gap = 4; this.buttonOpen.TabIndex = 5;
this.stackPanel8.Location = new System.Drawing.Point(3, 253); this.buttonOpen.Text = "打 开";
this.stackPanel8.Name = "stackPanel8"; this.buttonOpen.Type = AntdUI.TTypeMini.Success;
this.stackPanel8.Size = new System.Drawing.Size(744, 32); this.buttonOpen.WaveSize = 0;
this.stackPanel8.TabIndex = 27;
this.stackPanel8.Text = "stackPanel8";
//
// stackPanel2
//
this.stackPanel2.Controls.Add(this.buttonCZ);
this.stackPanel2.Controls.Add(this.buttonClose);
this.stackPanel2.Location = new System.Drawing.Point(3, 291);
this.stackPanel2.Name = "stackPanel2";
this.stackPanel2.Size = new System.Drawing.Size(744, 38);
this.stackPanel2.TabIndex = 28;
this.stackPanel2.Text = "stackPanel2";
// //
// buttonCZ // buttonCZ
// //
this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonCZ.Location = new System.Drawing.Point(84, 3); this.buttonCZ.Location = new System.Drawing.Point(165, 3);
this.buttonCZ.Name = "buttonCZ"; this.buttonCZ.Name = "buttonCZ";
this.buttonCZ.Size = new System.Drawing.Size(75, 32); this.buttonCZ.Size = new System.Drawing.Size(75, 32);
this.buttonCZ.TabIndex = 4; this.buttonCZ.TabIndex = 7;
this.buttonCZ.Text = "重 置"; this.buttonCZ.Text = "重 置";
this.buttonCZ.Type = AntdUI.TTypeMini.Warn; this.buttonCZ.Type = AntdUI.TTypeMini.Warn;
this.buttonCZ.WaveSize = 0; this.buttonCZ.WaveSize = 0;
@ -539,71 +603,14 @@
// buttonClose // buttonClose
// //
this.buttonClose.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.buttonClose.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonClose.Location = new System.Drawing.Point(3, 3); this.buttonClose.Location = new System.Drawing.Point(84, 3);
this.buttonClose.Name = "buttonClose"; this.buttonClose.Name = "buttonClose";
this.buttonClose.Size = new System.Drawing.Size(75, 32); this.buttonClose.Size = new System.Drawing.Size(75, 32);
this.buttonClose.TabIndex = 3; this.buttonClose.TabIndex = 6;
this.buttonClose.Text = "关 闭"; this.buttonClose.Text = "关 闭";
this.buttonClose.Type = AntdUI.TTypeMini.Error; this.buttonClose.Type = AntdUI.TTypeMini.Error;
this.buttonClose.WaveSize = 0; this.buttonClose.WaveSize = 0;
// //
// colorPicker
//
this.colorPicker.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.colorPicker.Location = new System.Drawing.Point(105, 3);
this.colorPicker.Name = "colorPicker";
this.colorPicker.ShowText = true;
this.colorPicker.Size = new System.Drawing.Size(75, 26);
this.colorPicker.TabIndex = 30;
this.colorPicker.Text = "colorPicker1";
this.colorPicker.Value = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(119)))), ((int)(((byte)(255)))));
this.colorPicker.WaveSize = 0;
//
// label16
//
this.label16.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label16.Location = new System.Drawing.Point(3, 3);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(92, 26);
this.label16.TabIndex = 29;
this.label16.Text = "BadgeBack";
//
// switch_loading
//
this.switch_loading.AutoCheck = true;
this.switch_loading.Location = new System.Drawing.Point(492, 3);
this.switch_loading.Name = "switch_loading";
this.switch_loading.Size = new System.Drawing.Size(50, 26);
this.switch_loading.TabIndex = 30;
this.switch_loading.Text = "switch1";
//
// label2
//
this.label2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(390, 3);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(92, 26);
this.label2.TabIndex = 29;
this.label2.Text = "Loading";
//
// switch_enabled
//
this.switch_enabled.AutoCheck = true;
this.switch_enabled.Location = new System.Drawing.Point(292, 3);
this.switch_enabled.Name = "switch_enabled";
this.switch_enabled.Size = new System.Drawing.Size(50, 26);
this.switch_enabled.TabIndex = 32;
this.switch_enabled.Text = "switch1";
//
// label18
//
this.label18.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label18.Location = new System.Drawing.Point(190, 3);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(92, 26);
this.label18.TabIndex = 31;
this.label18.Text = "Enabled";
//
// FloatButtonDemo // FloatButtonDemo
// //
this.Controls.Add(this.stackPanel1); this.Controls.Add(this.stackPanel1);
@ -611,15 +618,14 @@
this.Controls.Add(this.header1); this.Controls.Add(this.header1);
this.Name = "FloatButtonDemo"; this.Name = "FloatButtonDemo";
this.Size = new System.Drawing.Size(750, 492); this.Size = new System.Drawing.Size(750, 492);
this.Load += new System.EventHandler(this.FloatButtonDemo_Load);
this.stackPanel1.ResumeLayout(false); this.stackPanel1.ResumeLayout(false);
this.stackPanel2.ResumeLayout(false);
this.stackPanel8.ResumeLayout(false);
this.stackPanel6.ResumeLayout(false); this.stackPanel6.ResumeLayout(false);
this.stackPanel5.ResumeLayout(false); this.stackPanel5.ResumeLayout(false);
this.stackPanel7.ResumeLayout(false); this.stackPanel7.ResumeLayout(false);
this.stackPanel4.ResumeLayout(false); this.stackPanel4.ResumeLayout(false);
this.stackPanel3.ResumeLayout(false); this.stackPanel3.ResumeLayout(false);
this.stackPanel8.ResumeLayout(false);
this.stackPanel2.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -661,8 +667,6 @@
private AntdUI.Select select_type; private AntdUI.Select select_type;
private AntdUI.Label label13; private AntdUI.Label label13;
private AntdUI.StackPanel stackPanel2; private AntdUI.StackPanel stackPanel2;
private AntdUI.Button buttonCZ;
private AntdUI.Button buttonClose;
private AntdUI.StackPanel stackPanel8; private AntdUI.StackPanel stackPanel8;
private AntdUI.Switch switch_enabled; private AntdUI.Switch switch_enabled;
private AntdUI.Label label18; private AntdUI.Label label18;
@ -670,5 +674,8 @@
private AntdUI.Label label16; private AntdUI.Label label16;
private AntdUI.Switch switch_loading; private AntdUI.Switch switch_loading;
private AntdUI.Label label2; private AntdUI.Label label2;
private AntdUI.Button buttonCZ;
private AntdUI.Button buttonClose;
private AntdUI.Button buttonOpen;
} }
} }

View File

@ -21,14 +21,9 @@ namespace AntdUIDemo.Views
BindEventHandler(); BindEventHandler();
} }
private void FloatButtonDemo_Load(object sender, EventArgs e)
{
// 加载浮动按钮
LoadFloatButton();
}
private void BindEventHandler() private void BindEventHandler()
{ {
buttonOpen.Click += ButtonOpen_Click;
buttonClose.Click += buttonClose_Click; buttonClose.Click += buttonClose_Click;
buttonCZ.Click += buttonCZ_Click; buttonCZ.Click += buttonCZ_Click;
@ -53,6 +48,11 @@ namespace AntdUIDemo.Views
colorPicker.ValueChanged += colorPicker_ValueChanged; colorPicker.ValueChanged += colorPicker_ValueChanged;
} }
private void ButtonOpen_Click(object sender, EventArgs e)
{
LoadFloatButton();
}
// 初始化下拉框 // 初始化下拉框
private void InitSelectItems() private void InitSelectItems()
{ {

View File

@ -124,7 +124,7 @@
// tabs1 // tabs1
// //
this.tabs1.Centered = true; this.tabs1.Centered = true;
this.tabs1.Cursor = System.Windows.Forms.Cursors.Default; this.tabs1.Cursor = System.Windows.Forms.Cursors.Hand;
this.tabs1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabs1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabs1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tabs1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabs1.Gap = 12; this.tabs1.Gap = 12;
@ -151,7 +151,6 @@
// //
// menu_inline // menu_inline
// //
this.menu_inline.AutoCollapse = true;
this.menu_inline.Dock = System.Windows.Forms.DockStyle.Left; this.menu_inline.Dock = System.Windows.Forms.DockStyle.Left;
this.menu_inline.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.menu_inline.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.menu_inline.Indent = true; this.menu_inline.Indent = true;
@ -213,7 +212,6 @@
// //
// menu_vertical // menu_vertical
// //
this.menu_vertical.AutoCollapse = true;
this.menu_vertical.Dock = System.Windows.Forms.DockStyle.Left; this.menu_vertical.Dock = System.Windows.Forms.DockStyle.Left;
this.menu_vertical.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.menu_vertical.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.menu_vertical.Indent = true; this.menu_vertical.Indent = true;
@ -259,7 +257,7 @@
this.menu_vertical.Location = new System.Drawing.Point(9, 9); this.menu_vertical.Location = new System.Drawing.Point(9, 9);
this.menu_vertical.Mode = AntdUI.TMenuMode.Vertical; this.menu_vertical.Mode = AntdUI.TMenuMode.Vertical;
this.menu_vertical.Name = "menu_vertical"; this.menu_vertical.Name = "menu_vertical";
this.menu_vertical.Size = new System.Drawing.Size(164, 418); this.menu_vertical.Size = new System.Drawing.Size(185, 418);
this.menu_vertical.TabIndex = 5; this.menu_vertical.TabIndex = 5;
this.menu_vertical.Text = "menu1"; this.menu_vertical.Text = "menu1";
// //
@ -276,7 +274,6 @@
// //
// menu_horizontal // menu_horizontal
// //
this.menu_horizontal.AutoCollapse = true;
this.menu_horizontal.Dock = System.Windows.Forms.DockStyle.Top; this.menu_horizontal.Dock = System.Windows.Forms.DockStyle.Top;
this.menu_horizontal.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.menu_horizontal.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.menu_horizontal.Indent = true; this.menu_horizontal.Indent = true;

BIN
assets/screenshots/Demo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 95 KiB