diff --git a/Languages/Localizer_en-US.cs b/Languages/Localizer_en-US.cs new file mode 100644 index 0000000..a342478 --- /dev/null +++ b/Languages/Localizer_en-US.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AntdUIDemo.Languages +{ + public class Localizer_enus : AntdUI.ILocalization + { + public string GetLocalizedString(string key) + { + switch (key) + { + case "search": + return "Search"; + case "welcome": + return "Welcome to the AntdUI Demo"; + case "home": + return "Home"; + case "closeall": + return "Close all tabs"; + #region systemset + case "systemset": + return "System Settings"; + case "baseset": + return "Basic Settings"; + case "messageconfig": + return "Message configuration"; + case "animationon": + return "Turn on animation"; + case "shadowon": + return "Enable shadow"; + case "scrollbarhide": + return "Hide scrollbar"; + case "showinwindow": + return "Show in window"; + case "windowOffsetXY": + return "WindowOffsetXY"; + case "tip": + return "Tip"; + case "switchsuccess": + return "Switch successful."; + #endregion + + #region Button + case "Button.Text": + return "Button"; + case "Button.Description": + return "To trigger an operation."; + case "type": + return "Type"; + case "wave": + return "Wave"; + case "loading": + return "Loading"; + case "ghost": + return "Ghost"; + case "border": + return "Border"; + case "icon": + return "Icon"; + case "arrow": + return "Arrow"; + case "join": + return "Join"; + case "gradient": + return "Gradient"; + case "toggle": + return "Toggle"; + #endregion + + #region FloatButton + case "FloatButton.Text": + return "FloatButton"; + case "FloatButton.Description": + return "A button that floats at the top of the page."; + case "FloatButton.Tip": + return "FloatButton does not have a toolbox control and is called code."; + case "control_option": + return "Control Options"; + case "button_option": + return "Button Options"; + case "open": + return "Open"; + case "close": + return "Close"; + case "reset": + return "Reset"; + #endregion + + #region Icon + case "Icon.Text": + return "Icon"; + case "Icon.Description": + return "Semantic vector graphics."; + case "Icon.Tip": + return "Icon does not have a toolbox control and is used for Svg property assignments."; + case "outlined": + return "Outlined"; + case "filled": + return "Filled"; + case "directionalicon": + return "Directional icons"; + case "suggestionicon": + return "Suggestion Icon"; + case "editingicon": + return "Editing Icons"; + case "dataicon": + return "Data icons"; + case "brand": + return "Brand and logo"; + case "universal": + return "Universal Icons for Websites"; + case "copysuccess": + return "Copy successful!"; + case "copyfail": + return "Copy failed!"; + #endregion + default: + return null; + + } + } + } +} diff --git a/MainWindow.Designer.cs b/MainWindow.Designer.cs index ba3deea..0baeeab 100644 --- a/MainWindow.Designer.cs +++ b/MainWindow.Designer.cs @@ -29,9 +29,10 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow)); - AntdUI.Tabs.StyleCard styleCard6 = new AntdUI.Tabs.StyleCard(); + AntdUI.Tabs.StyleCard styleCard2 = new AntdUI.Tabs.StyleCard(); this.titlebar = new AntdUI.PageHeader(); this.input_search = new AntdUI.Input(); + this.dropdown_translate = new AntdUI.Dropdown(); this.button_color = new AntdUI.Button(); this.buttonSZ = new AntdUI.Button(); this.pageHeader1 = new AntdUI.PageHeader(); @@ -49,6 +50,7 @@ // titlebar // this.titlebar.Controls.Add(this.input_search); + this.titlebar.Controls.Add(this.dropdown_translate); this.titlebar.Controls.Add(this.button_color); this.titlebar.Controls.Add(this.buttonSZ); this.titlebar.DividerShow = true; @@ -59,7 +61,7 @@ this.titlebar.ShowButton = true; this.titlebar.ShowIcon = true; this.titlebar.Size = new System.Drawing.Size(1024, 40); - this.titlebar.SubText = "Demo 1.8.4"; + this.titlebar.SubText = "Demo"; this.titlebar.TabIndex = 0; this.titlebar.Text = "AntdUI"; // @@ -68,12 +70,28 @@ this.input_search.AllowClear = true; this.input_search.Dock = System.Windows.Forms.DockStyle.Right; this.input_search.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F); - this.input_search.Location = new System.Drawing.Point(580, 0); + this.input_search.LocalizationPlaceholderText = "search"; + this.input_search.Location = new System.Drawing.Point(530, 0); this.input_search.Name = "input_search"; - this.input_search.PlaceholderText = "输入关键字搜索..."; + this.input_search.PlaceholderText = "搜索"; this.input_search.PrefixSvg = "SearchOutlined"; this.input_search.Size = new System.Drawing.Size(200, 40); - this.input_search.TabIndex = 2; + this.input_search.TabIndex = 4; + // + // dropdown_translate + // + this.dropdown_translate.Dock = System.Windows.Forms.DockStyle.Right; + this.dropdown_translate.Ghost = true; + this.dropdown_translate.IconSvg = "TranslationOutlined"; + this.dropdown_translate.Items.AddRange(new object[] { + "简体中文", + "English"}); + this.dropdown_translate.Location = new System.Drawing.Point(730, 0); + this.dropdown_translate.Name = "dropdown_translate"; + this.dropdown_translate.Size = new System.Drawing.Size(50, 40); + this.dropdown_translate.TabIndex = 3; + this.dropdown_translate.Trigger = AntdUI.Trigger.Hover; + this.dropdown_translate.WaveSize = 0; // // button_color // @@ -128,15 +146,15 @@ // // tabs // - this.tabs.Cursor = System.Windows.Forms.Cursors.Default; + this.tabs.Cursor = System.Windows.Forms.Cursors.Hand; this.tabs.Dock = System.Windows.Forms.DockStyle.Fill; this.tabs.Gap = 20; - this.tabs.Location = new System.Drawing.Point(50, 40); + this.tabs.Location = new System.Drawing.Point(70, 40); this.tabs.Name = "tabs"; this.tabs.Pages.Add(this.tabPage); - this.tabs.Size = new System.Drawing.Size(974, 560); - styleCard6.Closable = true; - this.tabs.Style = styleCard6; + this.tabs.Size = new System.Drawing.Size(954, 560); + styleCard2.Closable = true; + this.tabs.Style = styleCard2; this.tabs.TabIndex = 9; this.tabs.Type = AntdUI.TabType.Card; // @@ -147,9 +165,9 @@ 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.Size = new System.Drawing.Size(948, 517); this.tabPage.TabIndex = 1; - this.tabPage.Text = "首页"; + this.tabPage.Text = "主页"; // // panel_content // @@ -158,7 +176,7 @@ this.panel_content.Location = new System.Drawing.Point(0, 0); this.panel_content.Name = "panel_content"; this.panel_content.Radius = 0; - this.panel_content.Size = new System.Drawing.Size(968, 517); + this.panel_content.Size = new System.Drawing.Size(948, 517); this.panel_content.TabIndex = 4; // // menu @@ -170,7 +188,7 @@ this.menu.Indent = true; this.menu.Location = new System.Drawing.Point(0, 40); this.menu.Name = "menu"; - this.menu.Size = new System.Drawing.Size(50, 560); + this.menu.Size = new System.Drawing.Size(70, 560); this.menu.TabIndex = 8; this.menu.Unique = true; // @@ -200,12 +218,13 @@ private AntdUI.PageHeader titlebar; private AntdUI.Button buttonSZ; private AntdUI.Button button_color; - 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.Menu menu; + private AntdUI.Dropdown dropdown_translate; + private AntdUI.Input input_search; } } \ No newline at end of file diff --git a/MainWindow.cs b/MainWindow.cs index 7f84359..d129081 100644 --- a/MainWindow.cs +++ b/MainWindow.cs @@ -1,5 +1,6 @@ using AntdUI; using AntdUIDemo.Controls; +using AntdUIDemo.Languages; using AntdUIDemo.Models; using AntdUIDemo.Utils; using AntdUIDemo.Views; @@ -14,29 +15,43 @@ namespace AntdUIDemo public partial class MainWindow : AntdUI.Window { private UserControl currControl; - private bool isUpdatingTabs = false; + private bool isUpdatingTabs = false;//用于阻止Tabs更新 private bool isLight = true; + // 定义一个语言切换事件 + public event EventHandler LanguageChanged; public MainWindow() { InitializeComponent(); //加载菜单 LoadMenu(); - //加载欢迎页 + //初始化数据 InitData(); //绑定事件 BindEventHandler(); } + // 触发事件 + protected virtual void OnLanguageChanged(EventArgs e) + { + LanguageChanged?.Invoke(this, e); + } + private void InitData() { + dropdown_translate.SelectedValue = dropdown_translate.Items[0]; //根据系统亮暗初始化一次 isLight = ThemeHelper.IsLightMode(); button_color.Toggle = !isLight; ThemeHelper.SetColorMode(this, isLight); + //初始化消息弹出位置 + Config.ShowInWindow = true; UserControl control = new Wellcome { Dock = DockStyle.Fill }; AutoDpi(control); panel_content.Controls.Add(control); + + //global + tabs.Pages[0].Text = AntdUI.Localization.Get("home", "主页"); } private void BindEventHandler() @@ -46,40 +61,79 @@ namespace AntdUIDemo input_search.TextChanged += Input_search_textchanged; menu.SelectChanged += Menu_SelectChanged; button_collapse.Click += Button_collapse_Click; + tabs.Click += Tabs_Click; tabs.SelectedIndexChanged += Tabs_SelectedIndexChanged; + dropdown_translate.SelectedValueChanged += Dropdown_translate_SelectedValueChanged; //监听系统深浅色变化 SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged; } - private void Tabs_SelectedIndexChanged(object sender, IntEventArgs e) + private void Tabs_Click(object sender, EventArgs e) { - if (isUpdatingTabs) return; - var text = tabs.SelectedTab?.Text; // 使用安全导航操作符,防止 SelectedTab 为 null - if (string.IsNullOrEmpty(text)) // 检查 text 是否为 null 或空 + // 强制转换 EventArgs 为 MouseEventArgs + MouseEventArgs mouseEventArgs = e as MouseEventArgs; + + if (mouseEventArgs != null) { - return; // 如果 text 为空,直接退出方法 - } - //首页 - if (text == "首页") - { - return; - } - var rootIndex = 0; - var subIndex = 0; - var menuItemsCopy = menu.Items.ToList(); // 创建副本 - for (int i = 0; i < menuItemsCopy.Count; i++) - { - for (int j = 0; j < menuItemsCopy[i].Sub.Count; j++) + if (mouseEventArgs.Button == MouseButtons.Right) { - if (menuItemsCopy[i].Sub[j].Tag.ToString() == text) + string closeall = AntdUI.Localization.Get("closeall", "关闭所有选项卡"); + var menulist = new AntdUI.IContextMenuStripItem[] { - rootIndex = i; - subIndex = j; - break; - } + new AntdUI.ContextMenuStripItem(closeall) + { + IconSvg= "CloseOutlined" + } + }; + + AntdUI.ContextMenuStrip.open(tabs, item => + { + if (item.Text == closeall) + { + // 只清除从第二个页面开始的控件 + for (int i = 1; i < tabs.Pages.Count; i++) + { + tabs.Pages[i].Controls.Clear(); + } + + // 移除除了第一个页面之外的所有页面 + if (tabs.Pages.Count > 1) + { + tabs.Pages.RemoveRange(1, tabs.Pages.Count - 1); // 从索引1开始,移除后面的所有页面 + } + tabs.SelectedIndex = 0; + } + + }, menulist); } } - menu.SelectIndex(rootIndex, subIndex, true); + } + + private void Dropdown_translate_SelectedValueChanged(object sender, ObjectNEventArgs e) + { + dropdown_translate.SelectedValue = e.Value; + if (e.Value.ToString() == "English") + { + AntdUI.Localization.Provider = new Localizer_enus(); + AntdUI.Localization.SetLanguage("en-US"); + } + else + { + AntdUI.Localization.Provider = null; + AntdUI.Localization.SetLanguage("zh-CN"); + } + tabs.Pages[0].Text = AntdUI.Localization.Get("home", "主页"); + + Refresh(); + LoadMenu(); + SelectMenu(); + //通知子窗口 + OnLanguageChanged(EventArgs.Empty); + } + + private void Tabs_SelectedIndexChanged(object sender, IntEventArgs e) + { + SelectMenu(); } private void Button_collapse_Click(object sender, EventArgs e) @@ -90,7 +144,7 @@ namespace AntdUIDemo } else { - menu.Width = (int)(50 * Config.Dpi); + menu.Width = (int)(70 * Config.Dpi); } button_collapse.Toggle = !button_collapse.Toggle; menu.Collapsed = !menu.Collapsed; @@ -126,7 +180,8 @@ namespace AntdUIDemo { using (var form = new SystemSet(this)) { - AntdUI.Modal.open(new AntdUI.Modal.Config(this, "系统设置", form, TType.Info) + string title = AntdUI.Localization.Get("systemset", "系统设置"); + AntdUI.Modal.open(new AntdUI.Modal.Config(this, title, form, TType.Info) { CloseIcon = true, BtnHeight = 0, @@ -138,10 +193,23 @@ namespace AntdUIDemo { menu.Items.Clear(); - foreach (var rootItem in DataUtil.MenuItems) + string lang = AntdUI.Localization.CurrentLanguage; + var menuItems = DataUtil.MenuItems_zhcn; + var menuIcons = DataUtil.MenuIcons_zhcn; + if (lang.StartsWith("en")) + { + menuItems = DataUtil.MenuItems_enus; + menuIcons = DataUtil.MenuIcons_enus; + } + + foreach (var rootItem in menuItems) { var rootKey = rootItem.Key.ToLower(); - var rootMenu = new AntdUI.MenuItem { Text = rootItem.Key, IconSvg = DataUtil.MenuIcons.TryGetValue(rootItem.Key, out var icon) ? icon : "UnorderedListOutlined" }; + var rootMenu = new AntdUI.MenuItem + { + Text = rootItem.Key, + IconSvg = menuIcons.TryGetValue(rootItem.Key, out var icon) ? icon : "UnorderedListOutlined", + }; bool rootVisible = false; // 用于标记是否显示根节点 foreach (var item in rootItem.Value) @@ -170,6 +238,37 @@ namespace AntdUIDemo } } + private void SelectMenu() + { + if (isUpdatingTabs) return; + var text = tabs.SelectedTab?.Text; // 使用安全导航操作符,防止 SelectedTab 为 null + if (string.IsNullOrEmpty(text)) // 检查 text 是否为 null 或空 + { + return; // 如果 text 为空,直接退出方法 + } + //首页 + if (text == AntdUI.Localization.Get("home", "主页")) + { + return; + } + var rootIndex = 0; + var subIndex = 0; + var menuItemsCopy = menu.Items.ToList(); // 创建副本 + for (int i = 0; i < menuItemsCopy.Count; i++) + { + for (int j = 0; j < menuItemsCopy[i].Sub.Count; j++) + { + if (menuItemsCopy[i].Sub[j].Tag.ToString() == text) + { + rootIndex = i; + subIndex = j; + break; + } + } + } + menu.SelectIndex(rootIndex, subIndex, true); + } + private void Menu_SelectChanged(object sender, MenuSelectEventArgs e) { string name = (string)e.Value.Tag; @@ -185,7 +284,9 @@ namespace AntdUIDemo { if (tab is AntdUI.TabPage existingTab && existingTab.Text == name) { + isUpdatingTabs = true; tabs.SelectedTab = existingTab; // 直接跳转到已存在的 TabPage + isUpdatingTabs = false; currControl = existingTab.Controls.Count > 0 ? existingTab.Controls[0] as UserControl : null; return; } @@ -203,6 +304,7 @@ namespace AntdUIDemo break; case "Icon": control = new IconDemo(this); + this.LanguageChanged += ((IconDemo)control).OnLanguageChanged; break; case "Divider": control = new DividerDemo(); diff --git a/Models/DataUtil.cs b/Models/DataUtil.cs index 21a9eb1..3692812 100644 --- a/Models/DataUtil.cs +++ b/Models/DataUtil.cs @@ -4,7 +4,7 @@ namespace AntdUIDemo.Models { public class DataUtil { - public static readonly Dictionary> MenuItems = new Dictionary>() + public static readonly Dictionary> MenuItems_zhcn = new Dictionary>() { { "通用", new List { @@ -19,8 +19,7 @@ namespace AntdUIDemo.Models new MenuItems { Text = "FlowPanel 流动布局", Tag = "FlowPanel"}, new MenuItems { Text = "GridPanel 网格布局", Tag = "GridPanel"}, new MenuItems { Text = "Panel 面板", Tag = "Panel"}, - new MenuItems { Text = "StackPanel 堆叠布局", Tag = "StackPanel"}, - //new MenuItems { Text = "VirtualPanel 虚拟布局", Tag = "VirtualPanel"} + new MenuItems { Text = "StackPanel 堆叠布局", Tag = "StackPanel"} } }, { "导航", new List @@ -99,7 +98,7 @@ namespace AntdUIDemo.Models } }; - public static readonly Dictionary MenuIcons = new Dictionary + public static readonly Dictionary MenuIcons_zhcn = new Dictionary { { "通用", "AppstoreOutlined" }, { "布局", "LayoutOutlined" }, @@ -111,6 +110,112 @@ namespace AntdUIDemo.Models { "其它", "SettingOutlined" } }; + public static readonly Dictionary> MenuItems_enus = new Dictionary>() + { + { "General", new List + { + new MenuItems { Text = "Button" , Tag = "Button"}, + new MenuItems { Text = "FloatButton", Tag = "FloatButton"}, + new MenuItems { Text = "Icon", Tag = "Icon"}, + } + }, + { "Layout", new List + { + new MenuItems { Text = "Divider", Tag = "Divider" }, + new MenuItems { Text = "FlowPanel", Tag = "FlowPanel"}, + new MenuItems { Text = "GridPanel", Tag = "GridPanel"}, + new MenuItems { Text = "Panel", Tag = "Panel"}, + new MenuItems { Text = "StackPanel", Tag = "StackPanel"} + } + }, + { "Navigation", new List + { + new MenuItems { Text = "Breadcrumb", Tag = "Breadcrumb"}, + new MenuItems { Text = "Dropdown", Tag = "Dropdown"}, + new MenuItems { Text = "Menu", Tag = "Menu"}, + new MenuItems { Text = "Pagination", Tag = "Pagination"}, + new MenuItems { Text = "Steps", Tag = "Steps"} + } + }, + { "Data Entry", new List + { + new MenuItems { Text = "Checkbox", Tag = "Checkbox"}, + new MenuItems { Text = "ColorPicker", Tag = "ColorPicker"}, + new MenuItems { Text = "DatePicker", Tag = "DatePicker"}, + new MenuItems { Text = "DatePickerRange", Tag = "DatePickerRange"}, + new MenuItems { Text = "Input", Tag = "Input"}, + new MenuItems { Text = "InputNumber", Tag = "InputNumber"}, + new MenuItems { Text = "Radio", Tag = "Radio"}, + new MenuItems { Text = "Rate", Tag = "Rate"}, + new MenuItems { Text = "Select", Tag = "Select"}, + new MenuItems { Text = "SelectMultiple", Tag = "SelectMultiple"}, + new MenuItems { Text = "Slider", Tag = "Slider"}, + new MenuItems { Text = "SliderRange", Tag = "SliderRange"}, + new MenuItems { Text = "Switch", Tag = "Switch"}, + new MenuItems { Text = "TimePicker", Tag = "TimePicker"}, + new MenuItems { Text = "UploadDragger", Tag = "UploadDragger"} + } + }, + { "Data Display", new List + { + new MenuItems { Text = "Avatar", Tag = "Avatar"}, + new MenuItems { Text = "Badge", Tag = "Badge"}, + new MenuItems { Text = "Calendar", Tag = "Calendar"}, + new MenuItems { Text = "Carousel", Tag = "Carousel"}, + new MenuItems { Text = "Collapse", Tag = "Collapse"}, + new MenuItems { Text = "Label", Tag = "Label"}, + new MenuItems { Text = "LabelTime", Tag = "LabelTime"}, + new MenuItems { Text = "Popover", Tag = "Popover"}, + new MenuItems { Text = "Preview", Tag = "Preview"}, + new MenuItems { Text = "Segmented", Tag = "Segmented"}, + new MenuItems { Text = "Table", Tag = "Table"}, + new MenuItems { Text = "Tabs", Tag = "Tabs"}, + new MenuItems { Text = "Tag", Tag = "Tag"}, + new MenuItems { Text = "Timeline", Tag = "Timeline"}, + new MenuItems { Text = "Tooltip", Tag = "Tooltip"}, + new MenuItems { Text = "Tree", Tag = "Tree"} + } + }, + { "Feedback", new List + { + new MenuItems { Text = "Alert", Tag = "Alert"}, + new MenuItems { Text = "Drawer", Tag = "Drawer"}, + new MenuItems { Text = "Message", Tag = "Message"}, + new MenuItems { Text = "Modal", Tag = "Modal"}, + new MenuItems { Text = "Notification", Tag = "Notification"}, + new MenuItems { Text = "Progress", Tag = "Progress"}, + new MenuItems { Text = "Spin", Tag = "Spin"} + } + }, + { "Chat", new List + { + new MenuItems { Text = "ChatList", Tag = "ChatList"}, + new MenuItems { Text = "MsgList", Tag = "MsgList"} + } + }, + { "Other", new List + { + new MenuItems { Text = "Battery", Tag = "Battery" }, + new MenuItems { Text = "ContextMenuStrip", Tag = "ContextMenuStrip" }, + new MenuItems { Text = "Image3D", Tag = "Image3D" }, + new MenuItems { Text = "PageHeader", Tag= "PageHeader"}, + new MenuItems { Text = "Signal", Tag = "Signal" } + } + } + }; + + public static readonly Dictionary MenuIcons_enus = new Dictionary +{ + { "General", "AppstoreOutlined" }, + { "Layout", "LayoutOutlined" }, + { "Navigation", "CompressOutlined" }, + { "Data Entry", "EditOutlined" }, + { "Data Display", "BarChartOutlined" }, + { "Feedback", "NotificationOutlined" }, + { "Chat", "MessageOutlined" }, + { "Other", "SettingOutlined" } +}; + } diff --git a/Program.cs b/Program.cs index ca0f108..d3f91d0 100644 --- a/Program.cs +++ b/Program.cs @@ -1,5 +1,4 @@ -using AntdUIDemo.Utils; -using System; +using System; using System.Windows.Forms; namespace AntdUIDemo diff --git a/README-en.md b/README-en.md new file mode 100644 index 0000000..963b0d2 --- /dev/null +++ b/README-en.md @@ -0,0 +1,174 @@ +
+ + + +

AntdUI Demo

+ +This project is developed based on `Winform .NET Framework 4.8`, and is a demo project of [AntdUI](https://gitee.com/antdui/AntdUI), the current version is `1.8.4` + +
+ +English | 中文 + +## ✅ Quick Start + +>1. Git clone or download the project directly +>2. Open this project using Visual Studio +>3. If the computer does not have the .NET Framework 4.8 installed, edit the project file to set the TargetFramework property to install the target framework for yourself, refer to [AntdUI Compatible Framework](https://www.nuget.org/packages/AntdUI#supportedframeworks-body-tab) +>4. Compile and run + +## ⚠️ Precautions +- COMPUTER SCREEN RESOLUTION IS LOWER THAN 1920×1080 (1080P) Please use a screen with a resolution greater than or equal to 1080P +- If `TargetFramework` is set to `net6.0-windows7.0` or later, you can directly open the form interface and display the following prompt +![coredesign](assets/screenshots/coredesign.png) +- If the `TargetFramework` is set to `net48` or lower, and the computer screen resolution is greater than 1080P or the scaling is not at 100%, it is essential to open the project using one of the following methods. For detailed reasons, please refer to [Fix HDPI/scaling issues with Windows Forms Designer in Visual Studio](https://learn.microsoft.com/zh-cn/visualstudio/designers/disable-dpi-awareness?view=vs-2022): + 1. Use the command `devenv /noScale` to start Visual Studio and click on `File - Open - Project/Solution`, as shown below. +![vsstart](assets/screenshots/vsstart.png) +![vsopen](assets/screenshots/vsopen.png) + 2. Directly open the project, and when prompted on the window page, click **Restart Visual Studio with 100% zoom** as shown below. +![design](assets/screenshots/design.png) + +## System Settings +- ✅ Support light/dark mode and automatically switch with the system +- ✅ Support enabling/disabling animation effects +- ✅ Support enabling/disabling shadow effects +- ✅ Support for displaying/hiding the scrollbar +- ✅ Support setting the message/notification display position + +![SystemSet](assets/screenshots/Demo-en.png) +![SystemSet](assets/screenshots/Dark-en.png) +![SystemSet](assets/screenshots/SystemSet-en.png) + +## Control Demo + +### General +#### Button +![Button](assets/screenshots/Button-en.png) +#### FloatButton +![FloatButton](assets/screenshots/FloatButton-en.png) +#### Icon +![Icon](assets/screenshots/Icon-en.png) + +### Layout +#### Divider +![Divider](assets/screenshots/Divider.png) +#### FlowPanel +![FlowPanel](assets/screenshots/FlowPanel.png) +#### GridPanel +![GridPanel](assets/screenshots/GridPanel.png) +#### Panel +![Panel](assets/screenshots/Panel.png) +#### StackPanel +![StackPanel](assets/screenshots/StackPanel.png) + +### Navigation +#### Breadcrumb +![Breadcrumb](assets/screenshots/Breadcrumb.png) +#### Dropdown +![Dropdown](assets/screenshots/Dropdown.png) +#### Menu +![Menu](assets/screenshots/Menu.png) +#### Pagination +![Pagination](assets/screenshots/Pagination.png) +#### Steps +![Steps](assets/screenshots/Steps.png) + +### Data Entry +#### Checkbox +![Checkbox](assets/screenshots/Checkbox.png) +#### ColorPicker +![ColorPicker](assets/screenshots/ColorPicker.png) +#### DatePicker +![DatePicker](assets/screenshots/DatePicker.png) +#### DatePickerRange +![DatePickerRange](assets/screenshots/DatePickerRange.png) +#### Input +![Input](assets/screenshots/Input.png) +#### InputNumber +![InputNumber](assets/screenshots/InputNumber.png) +#### Radio +![Radio](assets/screenshots/Radio.png) +#### Rate +![Rate](assets/screenshots/Rate.png) +#### Select +![Select](assets/screenshots/Select.png) +#### SelectMultiple +![SelectMultiple](assets/screenshots/SelectMultiple.png) +#### Slider +![Slider](assets/screenshots/Slider.png) +#### SliderRange +![SliderRange](assets/screenshots/SliderRange.png) +#### Switch +![Switch](assets/screenshots/Switch.png) +#### TimePicker +![TimePicker](assets/screenshots/TimePicker.png) +#### UploadDragger +![UploadDragger](assets/screenshots/UploadDragger.png) + +### Data Display +#### Avatar +![Avatar](assets/screenshots/Avatar.png) +#### Badge +![Badge](assets/screenshots/Badge.png) +#### Calendar +![Calendar](assets/screenshots/Calendar.png) +#### Carousel +![Carousel](assets/screenshots/Carousel.png) +#### Collapse +![Collapse](assets/screenshots/Collapse.png) +#### Label +![Label](assets/screenshots/Label.png) +#### LabelTime +![Label](assets/screenshots/LabelTime.png) +#### Popover +![Popover](assets/screenshots/Popover.png) +#### Preview +![Preview](assets/screenshots/Preview.png) +#### Segmented +![Segmented](assets/screenshots/Segmented.png) +#### Table +![Table](assets/screenshots/Table.png) +#### Tabs +![Tabs](assets/screenshots/Tabs.png) +#### Tag +![Tag](assets/screenshots/Tag.png) +#### Timeline +![Timeline](assets/screenshots/Timeline.png) +#### Tooltip +![Tooltip](assets/screenshots/Tooltip.png) +#### Tree +![Tree](assets/screenshots/Tree.png) + +### Feedback +#### Alert +![Alert](assets/screenshots/Alert.png) +#### Drawer +![Drawer](assets/screenshots/Drawer.png) +#### Message +![Message](assets/screenshots/Message.png) +#### Modal +![Modal](assets/screenshots/Modal.png) +#### Notification +![Notification](assets/screenshots/Notification.png) +#### Progress +![Progress](assets/screenshots/Progress.png) +#### Spin +![Spin](assets/screenshots/Spin.png) + +### Chat +#### ChatList +![ChatList](assets/screenshots/ChatList.png) +#### MsgList +![MsgList](assets/screenshots/MsgList.png) + +### Other +#### Battery +![Battery](assets/screenshots/Battery.png) +#### ContextMenuStrip +![ContextMenuStrip](assets/screenshots/ContextMenuStrip.png) +#### Image3D +![Image3D](assets/screenshots/Image3D.png) +#### PageHeader +![PageHeader](assets/screenshots/PageHeader.png) +#### Signal +![Signal](assets/screenshots/Signal.png) \ No newline at end of file diff --git a/README.md b/README.md index 318980c..83b9927 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ +中文 | English + ## ✅ 快速开始 >1. git clone 或者直接下载本项目 diff --git a/Views/ButtonDemo.Designer.cs b/Views/ButtonDemo.Designer.cs index 82f689b..c8a2af7 100644 --- a/Views/ButtonDemo.Designer.cs +++ b/Views/ButtonDemo.Designer.cs @@ -126,6 +126,8 @@ this.header1.DividerShow = true; this.header1.Dock = System.Windows.Forms.DockStyle.Top; this.header1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); + this.header1.LocalizationDescription = "Button.Description"; + this.header1.LocalizationText = "Button.Text"; this.header1.Location = new System.Drawing.Point(0, 0); this.header1.Name = "header1"; this.header1.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10); @@ -181,6 +183,7 @@ this.button_toggle3.Cursor = System.Windows.Forms.Cursors.Default; this.button_toggle3.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); this.button_toggle3.IconPosition = AntdUI.TAlignMini.Right; + this.button_toggle3.LocalizationText = "search"; this.button_toggle3.Location = new System.Drawing.Point(175, 3); this.button_toggle3.Name = "button_toggle3"; this.button_toggle3.RightToLeft = System.Windows.Forms.RightToLeft.No; @@ -200,6 +203,7 @@ this.button_toggle2.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); this.button_toggle2.IconPosition = AntdUI.TAlignMini.Right; this.button_toggle2.IconSvg = resources.GetString("button_toggle2.IconSvg"); + this.button_toggle2.LocalizationText = "search"; this.button_toggle2.Location = new System.Drawing.Point(89, 3); this.button_toggle2.Name = "button_toggle2"; this.button_toggle2.RightToLeft = System.Windows.Forms.RightToLeft.No; @@ -221,6 +225,7 @@ // label10 // this.label10.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label10.LocalizationText = "toggle"; this.label10.Location = new System.Drawing.Point(3, 711); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(744, 24); @@ -282,6 +287,7 @@ // label9 // this.label9.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label9.LocalizationText = "gradient"; this.label9.Location = new System.Drawing.Point(3, 631); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(744, 24); @@ -387,6 +393,7 @@ // label8 // this.label8.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label8.LocalizationText = "join"; this.label8.Location = new System.Drawing.Point(3, 551); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(744, 24); @@ -412,10 +419,11 @@ this.button28.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.button28.Ghost = true; this.button28.IconSvg = resources.GetString("button28.IconSvg"); - this.button28.Location = new System.Drawing.Point(347, 3); + this.button28.LocalizationText = "search"; + this.button28.Location = new System.Drawing.Point(367, 3); this.button28.Name = "button28"; this.button28.ShowArrow = true; - this.button28.Size = new System.Drawing.Size(80, 38); + this.button28.Size = new System.Drawing.Size(100, 38); this.button28.TabIndex = 11; this.button28.Text = "搜索"; this.button28.Type = AntdUI.TTypeMini.Primary; @@ -425,10 +433,11 @@ this.button27.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.button27.Ghost = true; this.button27.IconSvg = resources.GetString("button27.IconSvg"); + this.button27.LocalizationText = "search"; this.button27.Location = new System.Drawing.Point(261, 3); this.button27.Name = "button27"; this.button27.ShowArrow = true; - this.button27.Size = new System.Drawing.Size(80, 38); + this.button27.Size = new System.Drawing.Size(100, 38); this.button27.TabIndex = 10; this.button27.Text = "搜索"; this.button27.Type = AntdUI.TTypeMini.Primary; @@ -472,6 +481,7 @@ // label7 // this.label7.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label7.LocalizationText = "arrow"; this.label7.Location = new System.Drawing.Point(3, 471); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(744, 24); @@ -498,6 +508,7 @@ this.button21.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.button21.Ghost = true; this.button21.IconSvg = resources.GetString("button21.IconSvg"); + this.button21.LocalizationText = "search"; this.button21.Location = new System.Drawing.Point(307, 3); this.button21.Name = "button21"; this.button21.Size = new System.Drawing.Size(80, 38); @@ -523,6 +534,7 @@ this.button19.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.button19.Ghost = true; this.button19.IconSvg = resources.GetString("button19.IconSvg"); + this.button19.LocalizationText = "search"; this.button19.Location = new System.Drawing.Point(177, 3); this.button19.Name = "button19"; this.button19.RightToLeft = System.Windows.Forms.RightToLeft.No; @@ -547,6 +559,7 @@ // this.button23.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.button23.IconSvg = resources.GetString("button23.IconSvg"); + this.button23.LocalizationText = "search"; this.button23.Location = new System.Drawing.Point(47, 3); this.button23.Name = "button23"; this.button23.Size = new System.Drawing.Size(80, 38); @@ -566,6 +579,7 @@ // label6 // this.label6.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label6.LocalizationText = "icon"; this.label6.Location = new System.Drawing.Point(3, 391); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(744, 24); @@ -660,6 +674,7 @@ // label5 // this.label5.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label5.LocalizationText = "border"; this.label5.Location = new System.Drawing.Point(3, 311); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(744, 24); @@ -748,6 +763,7 @@ // label4 // this.label4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label4.LocalizationText = "ghost"; this.label4.Location = new System.Drawing.Point(3, 231); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(744, 24); @@ -867,6 +883,7 @@ // label12 // this.label12.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label12.LocalizationText = "loading"; this.label12.Location = new System.Drawing.Point(3, 157); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(744, 24); @@ -950,6 +967,7 @@ // label11 // this.label11.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label11.LocalizationText = "wave"; this.label11.Location = new System.Drawing.Point(3, 77); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(744, 24); @@ -1039,6 +1057,7 @@ // label3 // this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.LocalizationText = "type"; this.label3.Location = new System.Drawing.Point(3, 3); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(744, 24); diff --git a/Views/ButtonDemo.cs b/Views/ButtonDemo.cs index 06ef467..3701b3b 100644 --- a/Views/ButtonDemo.cs +++ b/Views/ButtonDemo.cs @@ -89,7 +89,7 @@ namespace AntdUIDemo.Views } if (!string.IsNullOrEmpty(iconsvg)) { - tooltipText.AppendLine($"IconSvg: 参见IconSvg属性"); + tooltipText.AppendLine($"IconSvg: See IconSvg Properties"); } if (backactive != null) { @@ -110,7 +110,7 @@ namespace AntdUIDemo.Views tooltipText.AppendLine($"ToggleType: {toggletype}"); if (!string.IsNullOrEmpty(toggleiconsvg)) { - tooltipText.AppendLine($"ToggleIconSvg: 参见ToggleIconSvg属性"); + tooltipText.AppendLine($"ToggleIconSvg: See ToggleIconSvg Properties"); } } if (loading) diff --git a/Views/FloatButtonDemo.Designer.cs b/Views/FloatButtonDemo.Designer.cs index f1eacc3..f14d425 100644 --- a/Views/FloatButtonDemo.Designer.cs +++ b/Views/FloatButtonDemo.Designer.cs @@ -31,6 +31,9 @@ this.header1 = new AntdUI.PageHeader(); this.stackPanel1 = new AntdUI.StackPanel(); this.stackPanel2 = new AntdUI.StackPanel(); + this.buttonCZ = new AntdUI.Button(); + this.buttonClose = new AntdUI.Button(); + this.buttonOpen = new AntdUI.Button(); this.stackPanel8 = new AntdUI.StackPanel(); this.switch_enabled = new AntdUI.Switch(); this.label18 = new AntdUI.Label(); @@ -70,9 +73,6 @@ this.label10 = new AntdUI.Label(); this.label4 = new AntdUI.Label(); this.label3 = new AntdUI.Label(); - this.buttonOpen = new AntdUI.Button(); - this.buttonCZ = new AntdUI.Button(); - this.buttonClose = new AntdUI.Button(); this.stackPanel1.SuspendLayout(); this.stackPanel2.SuspendLayout(); this.stackPanel8.SuspendLayout(); @@ -89,6 +89,8 @@ this.header1.DividerShow = true; this.header1.Dock = System.Windows.Forms.DockStyle.Top; this.header1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); + this.header1.LocalizationDescription = "FloatButton.Description"; + this.header1.LocalizationText = "FloatButton.Text"; this.header1.Location = new System.Drawing.Point(0, 0); this.header1.Name = "header1"; this.header1.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10); @@ -127,6 +129,42 @@ this.stackPanel2.TabIndex = 28; this.stackPanel2.Text = "stackPanel2"; // + // buttonCZ + // + this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.buttonCZ.LocalizationText = "reset"; + this.buttonCZ.Location = new System.Drawing.Point(165, 3); + this.buttonCZ.Name = "buttonCZ"; + this.buttonCZ.Size = new System.Drawing.Size(75, 32); + this.buttonCZ.TabIndex = 7; + this.buttonCZ.Text = "重 置"; + this.buttonCZ.Type = AntdUI.TTypeMini.Warn; + this.buttonCZ.WaveSize = 0; + // + // buttonClose + // + this.buttonClose.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.buttonClose.LocalizationText = "close"; + this.buttonClose.Location = new System.Drawing.Point(84, 3); + this.buttonClose.Name = "buttonClose"; + this.buttonClose.Size = new System.Drawing.Size(75, 32); + this.buttonClose.TabIndex = 6; + this.buttonClose.Text = "关 闭"; + this.buttonClose.Type = AntdUI.TTypeMini.Error; + this.buttonClose.WaveSize = 0; + // + // buttonOpen + // + this.buttonOpen.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.buttonOpen.LocalizationText = "open"; + this.buttonOpen.Location = new System.Drawing.Point(3, 3); + this.buttonOpen.Name = "buttonOpen"; + this.buttonOpen.Size = new System.Drawing.Size(75, 32); + this.buttonOpen.TabIndex = 5; + this.buttonOpen.Text = "打 开"; + this.buttonOpen.Type = AntdUI.TTypeMini.Success; + this.buttonOpen.WaveSize = 0; + // // stackPanel8 // this.stackPanel8.Controls.Add(this.switch_enabled); @@ -340,6 +378,7 @@ // label11 // this.label11.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); + this.label11.LocalizationText = "button_option"; this.label11.Location = new System.Drawing.Point(3, 147); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(744, 24); @@ -561,6 +600,7 @@ // label4 // this.label4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); + this.label4.LocalizationText = "control_option"; this.label4.Location = new System.Drawing.Point(3, 3); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(744, 24); @@ -571,6 +611,7 @@ // this.label3.Dock = System.Windows.Forms.DockStyle.Top; this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); + this.label3.LocalizationText = "FloatButton.Tip"; this.label3.Location = new System.Drawing.Point(0, 74); this.label3.Name = "label3"; this.label3.Padding = new System.Windows.Forms.Padding(0, 0, 0, 6); @@ -578,39 +619,6 @@ this.label3.TabIndex = 4; this.label3.Text = "FloatButton没有工具箱控件,使用代码方式调用。"; // - // buttonOpen - // - this.buttonOpen.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.buttonOpen.Location = new System.Drawing.Point(3, 3); - this.buttonOpen.Name = "buttonOpen"; - this.buttonOpen.Size = new System.Drawing.Size(75, 32); - this.buttonOpen.TabIndex = 5; - this.buttonOpen.Text = "打 开"; - this.buttonOpen.Type = AntdUI.TTypeMini.Success; - this.buttonOpen.WaveSize = 0; - // - // buttonCZ - // - 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(165, 3); - this.buttonCZ.Name = "buttonCZ"; - this.buttonCZ.Size = new System.Drawing.Size(75, 32); - this.buttonCZ.TabIndex = 7; - this.buttonCZ.Text = "重 置"; - this.buttonCZ.Type = AntdUI.TTypeMini.Warn; - this.buttonCZ.WaveSize = 0; - // - // buttonClose - // - 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(84, 3); - this.buttonClose.Name = "buttonClose"; - this.buttonClose.Size = new System.Drawing.Size(75, 32); - this.buttonClose.TabIndex = 6; - this.buttonClose.Text = "关 闭"; - this.buttonClose.Type = AntdUI.TTypeMini.Error; - this.buttonClose.WaveSize = 0; - // // FloatButtonDemo // this.Controls.Add(this.stackPanel1); diff --git a/Views/FloatButtonDemo.cs b/Views/FloatButtonDemo.cs index b9ec6d1..4f0edf6 100644 --- a/Views/FloatButtonDemo.cs +++ b/Views/FloatButtonDemo.cs @@ -104,9 +104,9 @@ namespace AntdUIDemo.Views new FloatButton.ConfigBtn("button1","",true) { // isSvg设置为true,text参数会赋值给IconSvg,否则赋值给Text,所以需要单独设置Text - Text = "SVG图片", + Text = "SVG Picture", IconSvg = "", - Tooltip = "SVG图片按钮", + Tooltip = "SVG Button", Round = switch_round.Checked, Type = (TTypeMini)select_type.SelectedValue, Radius = (int)input_radius.Value, @@ -119,8 +119,8 @@ namespace AntdUIDemo.Views // 使用资源图片 new FloatButton.ConfigBtn("button2", Properties.Resources.关闭) { - Text = "资源图片", - Tooltip = "资源图片按钮", + Text = "Resource Picture", + Tooltip = "Resource Picture Button", Round = switch_round.Checked, Type = (TTypeMini)select_type.SelectedValue, Radius = (int)input_radius.Value, @@ -131,9 +131,9 @@ namespace AntdUIDemo.Views Loading = switch_loading.Checked, }, // 使用文本 - new FloatButton.ConfigBtn("button3", "文本") + new FloatButton.ConfigBtn("button3", "Text") { - Tooltip = "文本按钮", + Tooltip = "Text Button", Round = switch_round.Checked, Type = (TTypeMini)select_type.SelectedValue, Radius = (int)input_radius.Value, diff --git a/Views/IconDemo.Designer.cs b/Views/IconDemo.Designer.cs index b395a3c..3a9e60f 100644 --- a/Views/IconDemo.Designer.cs +++ b/Views/IconDemo.Designer.cs @@ -47,6 +47,8 @@ this.header1.DividerShow = true; this.header1.Dock = System.Windows.Forms.DockStyle.Top; this.header1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); + this.header1.LocalizationDescription = "Icon.Description"; + this.header1.LocalizationText = "Icon.Text"; this.header1.Location = new System.Drawing.Point(0, 0); this.header1.Name = "header1"; this.header1.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10); @@ -102,9 +104,11 @@ this.txt_search.AllowClear = true; this.txt_search.Dock = System.Windows.Forms.DockStyle.Right; this.txt_search.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F); + this.txt_search.LocalizationPlaceholderText = "search"; + this.txt_search.LocalizationText = ""; this.txt_search.Location = new System.Drawing.Point(420, 0); this.txt_search.Name = "txt_search"; - this.txt_search.PlaceholderText = "输入关键字搜索..."; + this.txt_search.PlaceholderText = "搜索"; this.txt_search.PrefixSvg = "SearchOutlined"; this.txt_search.Size = new System.Drawing.Size(324, 38); this.txt_search.TabIndex = 19; @@ -113,6 +117,7 @@ // this.label3.Dock = System.Windows.Forms.DockStyle.Top; this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); + this.label3.LocalizationText = "Icon.Tip"; this.label3.Location = new System.Drawing.Point(0, 74); this.label3.Name = "label3"; this.label3.Padding = new System.Windows.Forms.Padding(10, 0, 10, 6); diff --git a/Views/IconDemo.cs b/Views/IconDemo.cs index c4070a6..4625031 100644 --- a/Views/IconDemo.cs +++ b/Views/IconDemo.cs @@ -18,6 +18,13 @@ namespace AntdUIDemo.Views BindEventHandler(); } + // 处理父窗体发来的事件 + public void OnLanguageChanged(object sender, EventArgs e) + { + //global + InitData(); + } + private void BindEventHandler() { segmented1.SelectIndexChanged += segmented1_SelectIndexChanged; @@ -45,50 +52,60 @@ namespace AntdUIDemo.Views vpanel.Items.Clear(); txt_search.Text = ""; vpanel.Items.AddRange(svgs); + + //global + segmented1.Items[0].Text = AntdUI.Localization.Get("outlined", "线框风格"); + segmented1.Items[1].Text = AntdUI.Localization.Get("filled", "实底风格"); } Dictionary> GetData() { var dir = new Dictionary>(AntdUI.SvgDb.Custom.Count); var tmp = new List(AntdUI.SvgDb.Custom.Count); + string directionalicon = AntdUI.Localization.Get("directionalicon", "方向性图标"); + string suggestionicon = AntdUI.Localization.Get("suggestionicon", "提示建议性图标"); + string editingicon = AntdUI.Localization.Get("editingicon", "编辑类图标"); + string dataicon = AntdUI.Localization.Get("dataicon", "数据类图标"); + string brand = AntdUI.Localization.Get("brand", "品牌和标识"); + string universal = AntdUI.Localization.Get("universal", "网站通用图标"); if (segmented1.SelectIndex == 0) { foreach (var it in AntdUI.SvgDb.Custom) { if (it.Key == "QuestionOutlined") { - dir.Add("方向性图标", new List(tmp)); + dir.Add(directionalicon, new List(tmp)); tmp.Clear(); } else if (it.Key == "EditOutlined") { - dir.Add("提示建议性图标", new List(tmp)); + dir.Add(suggestionicon, new List(tmp)); tmp.Clear(); } else if (it.Key == "AreaChartOutlined") { - dir.Add("编辑类图标", new List(tmp)); + dir.Add(editingicon, new List(tmp)); tmp.Clear(); } else if (it.Key == "AndroidOutlined") { - dir.Add("数据类图标", new List(tmp)); + dir.Add(dataicon, new List(tmp)); tmp.Clear(); } else if (it.Key == "AccountBookOutlined") { - dir.Add("品牌和标识", new List(tmp)); + dir.Add(brand, new List(tmp)); tmp.Clear(); } else if (it.Key == "StepBackwardFilled") { - dir.Add("网站通用图标", new List(tmp)); + dir.Add(universal, new List(tmp)); tmp.Clear(); return dir; } tmp.Add(new VItem(it.Key, it.Value)); } - dir.Add("网站通用图标", new List(tmp)); + dir.Add(universal, new List(tmp)); tmp.Clear(); } else @@ -99,32 +116,32 @@ namespace AntdUIDemo.Views if (it.Key == "StepBackwardFilled") isadd = true; else if (it.Key == "QuestionCircleFilled") { - dir.Add("方向性图标", new List(tmp)); + dir.Add(directionalicon, new List(tmp)); tmp.Clear(); } else if (it.Key == "EditFilled") { - dir.Add("提示建议性图标", new List(tmp)); + dir.Add(suggestionicon, new List(tmp)); tmp.Clear(); } else if (it.Key == "PieChartFilled") { - dir.Add("编辑类图标", new List(tmp)); + dir.Add(editingicon, new List(tmp)); tmp.Clear(); } else if (it.Key == "AndroidFilled") { - dir.Add("数据类图标", new List(tmp)); + dir.Add(dataicon, new List(tmp)); tmp.Clear(); } else if (it.Key == "AccountBookFilled") { - dir.Add("品牌和标识", new List(tmp)); + dir.Add(brand, new List(tmp)); tmp.Clear(); } if (isadd) tmp.Add(new VItem(it.Key, it.Value)); } - dir.Add("网站通用图标", new List(tmp)); + dir.Add(universal, new List(tmp)); tmp.Clear(); } return dir; @@ -219,10 +236,12 @@ namespace AntdUIDemo.Views private void vpanel_ItemClick(object sender, AntdUI.VirtualItemEventArgs e) { + string copysuccess = AntdUI.Localization.Get("copysuccess", "复制成功"); + string copyfail = AntdUI.Localization.Get("copyfail", "复制失败"); if (e.Item is VItem item) { - if (AntdUI.Helper.ClipboardSetText(this, item.Key)) AntdUI.Message.success(window, item.Key + " 复制成功"); - else AntdUI.Message.error(window, item.Key + " 复制失败"); + if (AntdUI.Helper.ClipboardSetText(this, item.Key)) AntdUI.Message.success(window, item.Key + " " + copysuccess); + else AntdUI.Message.error(window, item.Key + " " + copyfail); } } diff --git a/Views/SubView/SystemSet.Designer.cs b/Views/SubView/SystemSet.Designer.cs index debb0c3..c74b542 100644 --- a/Views/SubView/SystemSet.Designer.cs +++ b/Views/SubView/SystemSet.Designer.cs @@ -73,6 +73,7 @@ this.tabs.Name = "tabs"; this.tabs.Pages.Add(this.tabPage1); this.tabs.Pages.Add(this.tabPage2); + this.tabs.SelectedIndex = 1; this.tabs.Size = new System.Drawing.Size(598, 396); this.tabs.Style = styleLine1; this.tabs.TabIndex = 0; @@ -82,7 +83,7 @@ // this.tabPage1.Controls.Add(this.stackPanel1); this.tabPage1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); - this.tabPage1.Location = new System.Drawing.Point(90, 6); + this.tabPage1.Location = new System.Drawing.Point(-502, -384); this.tabPage1.Name = "tabPage1"; this.tabPage1.Size = new System.Drawing.Size(502, 384); this.tabPage1.TabIndex = 0; @@ -115,7 +116,7 @@ // this.switch_scrollbar.CheckedText = ""; this.switch_scrollbar.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.switch_scrollbar.Location = new System.Drawing.Point(129, 3); + this.switch_scrollbar.Location = new System.Drawing.Point(189, 3); this.switch_scrollbar.Name = "switch_scrollbar"; this.switch_scrollbar.Size = new System.Drawing.Size(60, 26); this.switch_scrollbar.TabIndex = 1; @@ -125,9 +126,10 @@ // // label4 // + this.label4.LocalizationText = "scrollbarhide"; this.label4.Location = new System.Drawing.Point(3, 3); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(120, 26); + this.label4.Size = new System.Drawing.Size(180, 26); this.label4.TabIndex = 0; this.label4.Text = "隐藏滚动条"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -147,7 +149,7 @@ this.switch_shadow.Checked = true; this.switch_shadow.CheckedText = ""; this.switch_shadow.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.switch_shadow.Location = new System.Drawing.Point(129, 3); + this.switch_shadow.Location = new System.Drawing.Point(189, 3); this.switch_shadow.Name = "switch_shadow"; this.switch_shadow.Size = new System.Drawing.Size(60, 26); this.switch_shadow.TabIndex = 1; @@ -157,9 +159,10 @@ // // label3 // + this.label3.LocalizationText = "shadowon"; this.label3.Location = new System.Drawing.Point(3, 3); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(120, 26); + this.label3.Size = new System.Drawing.Size(180, 26); this.label3.TabIndex = 0; this.label3.Text = "启用阴影"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -179,7 +182,7 @@ this.switch_animation.Checked = true; this.switch_animation.CheckedText = ""; this.switch_animation.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.switch_animation.Location = new System.Drawing.Point(129, 3); + this.switch_animation.Location = new System.Drawing.Point(189, 3); this.switch_animation.Name = "switch_animation"; this.switch_animation.Size = new System.Drawing.Size(60, 26); this.switch_animation.TabIndex = 1; @@ -189,9 +192,10 @@ // // label2 // + this.label2.LocalizationText = "animationon"; this.label2.Location = new System.Drawing.Point(3, 3); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(120, 26); + this.label2.Size = new System.Drawing.Size(180, 26); this.label2.TabIndex = 0; this.label2.Text = "开启动画"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -200,7 +204,7 @@ // this.tabPage2.Controls.Add(this.stackPanel6); this.tabPage2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.tabPage2.Location = new System.Drawing.Point(-502, -384); + this.tabPage2.Location = new System.Drawing.Point(90, 6); this.tabPage2.Name = "tabPage2"; this.tabPage2.Size = new System.Drawing.Size(502, 384); this.tabPage2.TabIndex = 0; @@ -230,7 +234,7 @@ // // input_offset // - this.input_offset.Location = new System.Drawing.Point(129, 3); + this.input_offset.Location = new System.Drawing.Point(189, 3); this.input_offset.Name = "input_offset"; this.input_offset.Size = new System.Drawing.Size(60, 26); this.input_offset.TabIndex = 1; @@ -239,9 +243,10 @@ // // label6 // + this.label6.LocalizationText = "windowOffsetXY"; this.label6.Location = new System.Drawing.Point(3, 3); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(120, 26); + this.label6.Size = new System.Drawing.Size(180, 26); this.label6.TabIndex = 0; this.label6.Text = "边界偏移量"; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -260,7 +265,7 @@ // this.switch_showinwindow.CheckedText = ""; this.switch_showinwindow.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.switch_showinwindow.Location = new System.Drawing.Point(129, 3); + this.switch_showinwindow.Location = new System.Drawing.Point(189, 3); this.switch_showinwindow.Name = "switch_showinwindow"; this.switch_showinwindow.Size = new System.Drawing.Size(60, 26); this.switch_showinwindow.TabIndex = 1; @@ -270,9 +275,10 @@ // // label5 // + this.label5.LocalizationText = "showinwindow"; this.label5.Location = new System.Drawing.Point(3, 3); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(120, 26); + this.label5.Size = new System.Drawing.Size(180, 26); this.label5.TabIndex = 0; this.label5.Text = "窗口内弹出"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; diff --git a/Views/SubView/SystemSet.cs b/Views/SubView/SystemSet.cs index 7007416..8aa81fd 100644 --- a/Views/SubView/SystemSet.cs +++ b/Views/SubView/SystemSet.cs @@ -37,6 +37,11 @@ namespace AntdUIDemo.Controls switch_scrollbar.Checked = Config.ScrollBarHide; switch_showinwindow.Checked = Config.ShowInWindow; input_offset.Value = Config.NoticeWindowOffsetXY; + + //global + tabs.Pages[0].Text = AntdUI.Localization.Get("baseset", "基本设置"); + tabs.Pages[1].Text = AntdUI.Localization.Get("messageconfig", "消息配置"); + } #region 事件 @@ -53,8 +58,10 @@ namespace AntdUIDemo.Controls private void Switch_showinwindow_CheckedChanged(object sender, BoolEventArgs e) { AntdUI.Config.ShowInWindow = e.Value; - AntdUI.Message.success(Window, "切换成功!", autoClose: 1); - AntdUI.Notification.success(Window, "提示", "切换成功!", autoClose: 1); + string text = AntdUI.Localization.Get("switchsuccess", "切换成功!"); + string tip = AntdUI.Localization.Get("tip", "提示"); + AntdUI.Message.success(Window, text, autoClose: 1); + AntdUI.Notification.success(Window, tip, text, autoClose: 1); } private void Switch_scrollbar_CheckedChanged(object sender, BoolEventArgs e) diff --git a/Views/SubView/Wellcome.Designer.cs b/Views/SubView/Wellcome.Designer.cs index 4f00bfc..da675f7 100644 --- a/Views/SubView/Wellcome.Designer.cs +++ b/Views/SubView/Wellcome.Designer.cs @@ -35,13 +35,13 @@ // this.label1.Dock = System.Windows.Forms.DockStyle.Fill; this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 20F); + this.label1.LocalizationText = "welcome"; this.label1.Location = new System.Drawing.Point(0, 0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(750, 150); this.label1.TabIndex = 0; this.label1.Text = "欢迎使用 AntdUI Demo"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.label1.TooltipConfig = null; // // Wellcome // diff --git a/assets/screenshots/Button-en.png b/assets/screenshots/Button-en.png new file mode 100644 index 0000000..8d3e114 Binary files /dev/null and b/assets/screenshots/Button-en.png differ diff --git a/assets/screenshots/Button.png b/assets/screenshots/Button.png index f7ea8e0..d9c40b6 100644 Binary files a/assets/screenshots/Button.png and b/assets/screenshots/Button.png differ diff --git a/assets/screenshots/Dark-en.png b/assets/screenshots/Dark-en.png new file mode 100644 index 0000000..dff6511 Binary files /dev/null and b/assets/screenshots/Dark-en.png differ diff --git a/assets/screenshots/Dark.png b/assets/screenshots/Dark.png index 647890e..6069dcc 100644 Binary files a/assets/screenshots/Dark.png and b/assets/screenshots/Dark.png differ diff --git a/assets/screenshots/Demo-en.png b/assets/screenshots/Demo-en.png new file mode 100644 index 0000000..68ae75c Binary files /dev/null and b/assets/screenshots/Demo-en.png differ diff --git a/assets/screenshots/Demo.png b/assets/screenshots/Demo.png index d47c9e1..496c724 100644 Binary files a/assets/screenshots/Demo.png and b/assets/screenshots/Demo.png differ diff --git a/assets/screenshots/FloatButton-en.png b/assets/screenshots/FloatButton-en.png new file mode 100644 index 0000000..dc48115 Binary files /dev/null and b/assets/screenshots/FloatButton-en.png differ diff --git a/assets/screenshots/FloatButton.png b/assets/screenshots/FloatButton.png index a2708cc..99b3134 100644 Binary files a/assets/screenshots/FloatButton.png and b/assets/screenshots/FloatButton.png differ diff --git a/assets/screenshots/Icon-en.png b/assets/screenshots/Icon-en.png new file mode 100644 index 0000000..6668ed2 Binary files /dev/null and b/assets/screenshots/Icon-en.png differ diff --git a/assets/screenshots/Icon.png b/assets/screenshots/Icon.png index 9cc58b0..68437c5 100644 Binary files a/assets/screenshots/Icon.png and b/assets/screenshots/Icon.png differ diff --git a/assets/screenshots/SystemSet-en.png b/assets/screenshots/SystemSet-en.png new file mode 100644 index 0000000..24f5cef Binary files /dev/null and b/assets/screenshots/SystemSet-en.png differ diff --git a/assets/screenshots/SystemSet.png b/assets/screenshots/SystemSet.png index 8d9292a..d5f0c5b 100644 Binary files a/assets/screenshots/SystemSet.png and b/assets/screenshots/SystemSet.png differ