增加文档

This commit is contained in:
Sunny 2024-09-22 21:18:27 +08:00
parent b3ef1e1288
commit aec616b1cf
105 changed files with 2057 additions and 0 deletions

View File

@ -0,0 +1,79 @@
import { defineConfig } from 'vitepress'
// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "SunnyUI",
description: "A Modern Winform UI",
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: '更新日志', link: '/updates' },
{ text: '文档', link: '/introduction' },
{ text: '源码', link: 'https://gitee.com/yhuse/SunnyUI'}
],
sidebar: [
{
text: '简介',
collapsed: false,
items: [
{ text: '项目说明', link: '/introduction' },
{ text: '更新日志', link: '/updates' },
{ text: '常见问题', link: '/faq' },
{ text: '安装', link: '/install' },
{ text: '主题', link: '/theme' },
{ text: '国际化', link: '/i18n' },
{ text: '字体图标', link: '/symbol' }
]
},
{
text: '多页面框架',
collapsed: false,
items: [
{ text: '快速开始', link: '/started' },
{ text: 'DPI缩放自适应方案', link: '/dpi' },
{ text: '全局字体设置', link: '/globalfont' }
]
}
],
socialLinks: [
{ icon: 'github', link: 'https://gitee.com/yhuse/SunnyUI' },
{ icon: 'github', link: 'https://github.com/yhuse/SunnyUI' }
],
footer: {
message: '基于 GPL3.0 许可发布',
copyright: `版权所有 © 2012-${new Date().getFullYear()} SunnyUI.Net`
},
editLink: {
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path',
text: '在 GitHub 上编辑此页面'
},
docFooter: {
prev: '上一页',
next: '下一页'
},
outline: {
label: '页面导航'
},
lastUpdated: {
text: '最后更新于',
formatOptions: {
dateStyle: 'short',
timeStyle: 'medium'
}
},
langMenuLabel: '多语言',
returnToTopLabel: '回到顶部',
sidebarMenuLabel: '菜单',
darkModeSwitchLabel: '主题',
lightModeSwitchTitle: '切换到浅色模式',
darkModeSwitchTitle: '切换到深色模式'
}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 975 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

55
docs/dpi.md Normal file
View File

@ -0,0 +1,55 @@
# DPI缩放自适应方案
---
Winform窗体随着屏幕的DPI缩放会引起窗体变形及字体变形。
SunnyUI的DPI缩放自适应方案目标为随着DPI缩放窗体和字体均不变形从而实现界面的美观。
主要有以下三步操作:
1、设置窗体和自定义用户控件的AutoScaleMode为None
实现目标:禁止窗体因为字体大小缩放变形
因为显示的高分屏然后操作系统的设置了字体缩放引起的。窗体默认的AutoScaleMode = Font控件会因为高分屏自动缩放。
解决方法设置窗体、用户控件的AutoScaleMode = None
![输入图片说明](./assets/230113_bf629fd4_416720.png)
当前版本的UIForm、UIPage和UIUserControl的AutoScaleMode都已经默认设置为None需要注意的是用户的自定义用户控件UserControl需要设置此属性。
2、设置app.manifest的dpiAware为true
实现目标禁止窗体因为DPI缩放变形
右键工程,添加应用程序清单 app.manifest, 文件名用默认,修改
![输入图片说明](./assets/dee603a8_416720.png)
这时候项目的文件里就多了app.manifest
![输入图片说明](./assets/222822_e1af3c23_416720.png)
取消这段的注释按下面代码修改打开感知DPI启用dpiAware
~~~
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI无需
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
~~~
3、设置DPIScale为true
实现目标DPI缩放后字体大小不变
**确认编译时DPI缩放为100%**
在主窗体上放置UIStyleManager控件
![输入图片说明](./assets/d14ecd4a_416720.png)
设置DPIScale为true
![输入图片说明](./assets/223611_dd027ca1_416720.png)
在确认 **编译时屏幕的DPI缩放为100%情况下** 编译程序在不同的DPI缩放下测试编译好的[SunnyUI.Demo.exe](https://gitee.com/yhuse/SunnyUI.Demo)

192
docs/faq.md Normal file
View File

@ -0,0 +1,192 @@
# 常见问题
---
开始使用SunnyUI前请先浏览一遍常见问题
## 更新了V3.5.0+版本后,界面字体不一致怎么办
按文档设置全局字体:
[全局字体设置](/globalfont)
## 我把一个窗体继承UIFormIsMdiContainer这个不能设置为true无法变为容器
SunnyUI有自己的多页面框架不支持MDI。
## 从码云下载下来的项目,编译直接出错嘛,怎么办?
兄弟先把码云项目下面的Readme.md仔细看看
SunnyUI.Net, 是基于.Net Framework 4.0+、.Net 5、.Net 6 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。
**源码编译环境:**
**VS2022**V3.0.9增加了.Net6的支持所以编译需要VS2022。
安装.NetFramework4.0目标包的方法见:[https://www.cnblogs.com/yhuse/p/15536393.html](https://www.cnblogs.com/yhuse/p/15536393.html)
**动态库应用环境:**
**VS2010及以上**应用开发时直接引用Dll.Net Framework 4.0及以上(不包括.Net Framework 4 Client Profile都可以。
未识别TargetFramework值“net5.0-windows”就是因为VS版本低了.Net5只有VS2019 16.8+以上才能运行
![输入图片说明](https://images.gitee.com/uploads/images/2021/0416/234550_c1e8282f_416720.png "屏幕截图.png")<br/>
未识别TargetFramework值“net6.0-windows”就是因为VS版本低了.Net6只有VS2022 17.0+以上才能运行
## 打开源码,显示依赖项都是感叹号
![输入图片说明](./assets/141000_65739de3_416720.png)
## 有可能是因为网络原因连不上Nuget服务器通过设置Nuget源为国内源即可。
Nuget包管理器设置程序包源https://nuget.cdn.azure.cn/v3/index.json
![输入图片说明](./assets/234016_f87a8a0d_416720.png)
## 界面的一些小图标的数字代号,是什么意思啊?
![输入图片说明](./assets/ba236da6_416720.png)
![输入图片说明](./assets/092717_c9fb3e99_416720.png)
就是图上框框里的图标和魔法数字其实用的是WEB开发常见的字体图标详见介绍
[字体图标](/symbol)
## 为什么有些控件,我改了颜色,编辑时的界面显示了,然后一编译运行,颜色就变了?
因为SunnyUI是带[**主题**](/theme) 风格的有统一的主题风格控件UIStyleManager来控制主题颜色。
所以你自己改的颜色在运行时被主题颜色覆盖了。
那有同学要问了,我就是要自己设置颜色,有没有方法呢?
有的SunnyUI也帮你考虑了。
![输入图片说明](./assets/094236_d9bc00e5_416720.png)
## 就是更改颜色后把控件的Style设置为CustomStyleCustomMode设置为True
StyleCustomMode就是接受用户自定义颜色的意思。
## 控件属性那么多SunnyUI到底怎么用呢
具体控件怎么用,主要还是看控件的属性,除了控件的原生属性外
SunnyUI已经将添加的属性进行了分类分类的标题就是SunnyUI
![输入图片说明](./assets/095848_3475ce27_416720.png)
点击控件分类选择SunnyUI类目下的属性在页脚会有属性的说明。
## 为什么继承的窗体,上面有小锁,能解开吗,还有就是继承的窗体,有些控件属性都设置不了,怎么办?
首先得了解窗体继承的概念和类的继承是差不多的窗体上有小锁的其实就是类似于类继承中父类的某个Private属性
为了保证继承窗体的UI设计上面的某些控件是不让修改和移动的所以有锁。
在使用时,父窗体一般都将其所用的控件的属性和事件进行了封装,可以正常使用。
举例:
![输入图片说明](./assets/011a9a81_416720.png)
继承的登录窗体的登录按钮有锁,但其点击事件已封装到父类的事件
![输入图片说明](./assets/105850_f7800c4b_416720.png)
## 为什么运行时的界面显示比设计期的大?
设计期:
![输入图片说明](./assets/150904_4a613bb0_416720.png)
运行期:
![输入图片说明](./assets/150921_ba2da459_416720.jpeg)
引起界面放大的原因主要又两个一是因为界面跟随字体放大二是界面跟随屏幕的DPI缩放引起的。
1. 因为显示的高分屏然后操作系统的设置了字体缩放引起的。窗体默认的AutoScaleMode = Font控件会因为高分屏自动缩放。
解决方法设置窗体、用户控件的AutoScaleMode = None
2. 设置app.manifest的dpiAware为true
~~~
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
~~~
3. 上述两步能解决窗体或者控件的缩放但是DPI缩放时字体在有些操作系统下并未跟随缩放。 **在保证编译时DPI缩放为100%** 参照Demo的FMain将StyleManager的DPIScale设置为True。
4. 详细操作步骤见:[https://gitee.com/yhuse/SunnyUI/wikis/多页面框架/DPI缩放自适应方案](https://gitee.com/yhuse/SunnyUI/wikis/%E5%A4%9A%E9%A1%B5%E9%9D%A2%E6%A1%86%E6%9E%B6/DPI%E7%BC%A9%E6%94%BE%E8%87%AA%E9%80%82%E5%BA%94%E6%96%B9%E6%A1%88)
## 工具箱找不到UILogo控件怎么用
UILogo是为SunnyUI定制的未加入工具箱有需要的在其位置放置一张图片即可。
## 框架页面切换时,每次要重新刷新页面的解决方法?
参考Demo的FButton.cs
放在 [窗体Load、重载OnLoad、重载Init] 的内容每次页面切换都会执行。这三个选一个用就行了。
~~~
/// <summary>
/// 放在 [窗体Load (NeedReload = true)] 的内容每次页面切换,进入页面都会执行。
/// 这三个选一个用就行了。
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FButton_Load(object sender, EventArgs e)
{
Console.WriteLine("1. FButton_Load");
}
//放在 [窗体Load (NeedReload = true)] 的内容每次页面切换,进入页面都会执行。
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Console.WriteLine("3. FButton_OnLoad");
}
//放在 [重载Init] 的内容每次页面切换,进入页面都会执行。
public override void Init()
{
base.Init();
uiSwitch1.Active = uiSwitch4.Active = true;
uiSwitch2.Active = uiSwitch3.Active = false;
Console.WriteLine("2. FButton_Init");
}
//放在 [Final] 的内容每次页面切换,退出页面都会执行
public override void Final()
{
base.Final();
Console.WriteLine("4. FButton_Final");
}
~~~
## 把控件从工具箱往界面上拖到时候的解决方法
如图所示
![输入图片说明](./assets/113921_3937490b_416720.png)
原因是工具箱里的控件和项目引用的控件的版本不一致
解决方法是把工具箱里的控件删除,重建添加,然后再拖放到窗体。
## 高清屏下字体模糊的解决方法
今天就遇到了之前遇到过的一个问题那就是WinForm在高分辨率下界面模糊。我的开发环境是Windows10 64位和VS2010电脑屏幕分辨率为1920*1080采用的是WinForm程序设计方法开发。在程序运行时遇到了这样一个问题在VS设计的很清晰的菜单和界面运行的时候菜单和控件上字体变得很模糊界面大小也发生了变化。于是上网寻求解决办法网友给出的解决方案有以下3种。
1、这里是列表文本WinForm对高分屏的支持不好用WPF程序设计可以解决该问题。(这是一个可行的办法但是短期内较好的掌握WPF并用WPF技术重现实现软件不太现实
2、更改窗体的AutoScaleMode属性为Font,并在窗体的构造函数中增加两行代码调整窗体上字体的大小。本人反复尝试,该方法行不通。
3、更改程序的配置文件在里面添加几行代码使程序运行时自动检测屏幕分辨率在高分屏时禁用系统缩放。
第三种方案的解决思路是正确的就是要检测屏幕的分辨率高分屏时禁用系统的缩放因为现在Win10 高分屏默认字体放大125这样会导致我们在程序中设计好的界面字体模糊。
具体步骤:
1、选择当前项目单击鼠标右键选择【添加】|【类】;
2、选择【应用程序清单文件】
3、打开刚才建立的清单文件添加下面的代码
4、保存运行发现修复了界面模糊问题。
```
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
```
PS有时候按照上面步骤可能不成功关掉程序重新打开运行后发现分辨率已协调亲测有效。
另外还是建议设置窗体、用户控件的AutoScaleMode = None
## SunnyUI.dll 中没有可放置在工具箱上的组件。
![输入图片说明](./assets/220602_755c9feb_416720.png)
请检查是否项目的.NetFramework环境为.Net Framework 4 Client Profile
动态库应用环境:**VS2010及以上** .Net Framework 4.0及以上(**不包括.Net Framework 4 Client Profile**)
## .Net5、.Net6的Winform编辑器相关问题
UINavBar报错
![输入图片说明](./assets/103655_1759d1cd_416720.png)
Symbol没有右侧的点击按钮
![输入图片说明](./assets/104206_49ce26f7_416720.png)
可参考 https://github.com/dotnet/winforms/issues/6193
建议将项目的运行环境换成.NetFramework。
## 未能加载程序集
![输入图片说明](./assets/141104_f53790f6_416720.png)
VS提醒的这么明确少啥加啥呗一共两个文件
**最好的做法是从Nuget引用SunnyUI**
或者直接引用已经编译好两个的DllSunnyUI.dllSunnyUI.Common.dll)
有时候VS也会抽风明明已经引用类两个dll还是提示少引用。那就把这两个引用都删除再重新引用。
## 文件中的类都不能进行设计,因此未能为该文件显示设计器...
![输入图片说明](./assets/1ff6a8f7_416720.png)
确认编译环境符合项目说明
确认已经引用了SunnyUI控件nuget引用没有黄色感叹号
清理项目重新编译关掉VS再重新打开VS。一般能解决此问题。

31
docs/globalfont.md Normal file
View File

@ -0,0 +1,31 @@
# 全局字体设置
---
SunnyUI 默认字体为系统默认字体(V3.5.0),可以设置全局字体,包括字体样式和字体缩放大小。
具体操作步骤如下
1、按DPI缩放自适应解决方案设置
[DPI缩放自适应方案](/dpi)
2、设置全局字体及字体缩放
![输入图片说明](./assets/e1dc8755_416720.png)
设置DPIScale为true。
设置GlobalFont为true。
设置GlobalFontName这是全局字体名称可下拉选择。
设置GlobalFontScale这是全局字体缩放大小比例SunnyUI 默认字体大小为12缩放比例默认100%。
例如想设置字体大小为9设置缩放比例为75
例如想设置字体大小为15设置缩放比例为125
3、运行时设置全局字体及字体缩放
见Demo的多彩主题
![输入图片说明](./assets/8357f821_416720.png)
~~~
UIStyles.DPIScale = true;
UIStyles.GlobalFont = true;
UIStyles.GlobalFontName = cbFont.Text;
UIStyles.GlobalFontScale = uiTrackBar1.Value;
UIStyles.SetDPIScale();
~~~

82
docs/i18n.md Normal file
View File

@ -0,0 +1,82 @@
# 国际化
---
SunnyUI控件内部默认使用中文若希望使用其他语言则需要进行多语言设置。
**本页面所描述的国际化是针对SunnyUI内的按钮、标题等中文资源的国际化**
**如您开发的系统需要做国际化请自行开发。**
常用的按钮、标题、提示等文字已经设置为静态字符串变量存于ULocalize.cs文件中。
```
public static class UILocalize
{
public static string InfoTitle = "提示";
public static string SuccessTitle = "正确";
public static string WarningTitle = "警告";
public static string ErrorTitle = "错误";
public static string AskTitle = "提示";
public static string InputTitle = "输入";
public static string CloseAll = "全部关闭";
public static string OK = "确定";
public static string Cancel = "取消";
public static string GridNoData = "[ 无数据 ]";
public static string GridDataLoading = "数据加载中 ......";
public static string GridDataSourceException = "数据源必须为DataTable或者List";
}
```
可以重写UILocalize类静态变量值来改变语言。
UILocalizeHelper类已经包含中文和英文的默认配置函数
```
public static class UILocalizeHelper
{
public static void SetEN()
{
UILocalize.InfoTitle = "Info";
UILocalize.SuccessTitle = "Success";
UILocalize.WarningTitle = "Warning";
UILocalize.ErrorTitle = "Error";
UILocalize.AskTitle = "Query";
UILocalize.InputTitle = "Input";
UILocalize.CloseAll = "Close all";
UILocalize.OK = "OK";
UILocalize.Cancel = "Cancel";
UILocalize.GridNoData = "[ No data ]";
UILocalize.GridDataLoading = "Data loading ......";
UILocalize.GridDataSourceException = "The data source must be DataTable or List";
}
public static void SetCH()
{
UILocalize.InfoTitle = "提示";
UILocalize.SuccessTitle = "正确";
UILocalize.WarningTitle = "警告";
UILocalize.ErrorTitle = "错误";
UILocalize.AskTitle = "提示";
UILocalize.InputTitle = "输入";
UILocalize.CloseAll = "全部关闭";
UILocalize.OK = "确定";
UILocalize.Cancel = "取消";
UILocalize.GridNoData = "[ 无数据 ]";
UILocalize.GridDataLoading = "数据加载中 ......";
UILocalize.GridDataSourceException = "数据源必须为DataTable或者List";
}
}
```
如需要其他语言则在自己程序里写函数更新UILocalize类静态变量值即可。
显示效果如下:
**中文:**
![输入图片说明](./assets/ee56fbe8_416720.png)
![输入图片说明](./assets/333c0146_416720.png)
**英文:**
![输入图片说明](./assets/f5745c98_416720.png)
![输入图片说明](./assets/747b8b77_416720.png)

35
docs/index.md Normal file
View File

@ -0,0 +1,35 @@
---
# https://vitepress.dev/reference/default-theme-home-page
layout: home
hero:
name: "SunnyUI"
text: "A Modern Winform UI"
tagline: SunnyUI.NET 是基于 .NET Framework 4.0+、.NET6、.NET8 框架的 C# WinForm UI、开源控件库、工具类库、扩展类库、多页面开发框架
actions:
- theme: brand
text: 什么是SunnyUI?
link: /introduction
- theme: alt
text: 快速开始
link: /started
features:
- icon: 🚀
title: 主流风格
details: 现代的、流行的、扁平化风格 Winform UI 框架
- icon: <svg t="1726975081909" class="icon" viewBox="0 0 1029 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4711" width="32" height="32"><path d="M166.187235 790.834764l-17.583636 15.010421a42.886918 42.886918 0 0 1-44.38796 6.433038l-77.839756-31.950754A42.886918 42.886918 0 0 1 0.000429 740.871505V283.268092a42.886918 42.886918 0 0 1 26.375454-39.455964l77.839756-31.950754a42.886918 42.886918 0 0 1 44.38796 7.076341l17.583636 15.010422a23.587805 23.587805 0 0 0-33.022926 5.575299 21.443459 21.443459 0 0 0-4.503127 13.08051v518.931705a23.802239 23.802239 0 0 0 23.80224 23.802239 24.445543 24.445543 0 0 0 13.723813-4.503126z" fill="#52218A" p-id="4712"></path><path d="M1029.286456 166.615676v2.35878a40.528137 40.528137 0 0 0-66.260288-31.30745L166.187235 790.834764l-17.583636 15.010421a42.886918 42.886918 0 0 1-44.38796 6.433038l-77.839756-31.950754A42.886918 42.886918 0 0 1 0.000429 740.871505v-3.645388a24.874412 24.874412 0 0 0 24.659978 24.874412 24.445543 24.445543 0 0 0 18.22694-8.362949L707.634572 18.870244A64.330377 64.330377 0 0 1 780.756767 6.433038l212.075809 102.070864A64.330377 64.330377 0 0 1 1029.286456 166.615676z" fill="#6C33AF" p-id="4713"></path><path d="M1029.286456 855.165141V857.738356a64.330377 64.330377 0 0 1-36.45388 57.897339l-212.075809 102.070864a64.330377 64.330377 0 0 1-73.122195-12.437206L42.887347 270.402017a24.874412 24.874412 0 0 0-34.952838-1.929912 25.088847 25.088847 0 0 0-7.93408 18.441375v-3.645388a42.886918 42.886918 0 0 1 26.375454-39.455964l77.839756-31.950754a42.886918 42.886918 0 0 1 44.38796 7.076341l17.583636 15.010422 796.838933 652.524454A40.528137 40.528137 0 0 0 1029.286456 855.165141z" fill="#854CC7" p-id="4714"></path><path d="M707.634572 1005.269353l4.717561 4.074257zM712.352133 14.795987L707.634572 18.870244zM992.832576 108.289467L780.756767 6.433038a64.330377 64.330377 0 0 0-68.404634 8.362949 37.740488 37.740488 0 0 1 52.536475 8.791818 36.882749 36.882749 0 0 1 7.076341 21.443459v933.6482a37.740488 37.740488 0 0 1-59.612816 30.664146 64.330377 64.330377 0 0 0 68.404634 8.362949l212.075809-101.85643A64.330377 64.330377 0 0 0 1029.286456 857.738356V166.401241a64.330377 64.330377 0 0 0-36.45388-58.111774z" fill="#B179F1" p-id="4715"></path></svg>
title: 支持广泛
details: 从 VS2010 到 VS2022最低支持 .NET Framework 4.0
- icon: <svg t="1726975192388" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8865" width="32" height="32"><path d="M926.487273 304.756364H97.512727v-172.683637c0-19.013818 15.546182-34.56 34.56-34.56h759.854546c19.013818 0 34.56 15.546182 34.56 34.56v172.683637zM304.756364 926.487273h-172.683637a34.629818 34.629818 0 0 1-34.56-34.56V373.829818h207.243637V926.487273z m587.170909 0H389.073455V373.829818H926.487273v518.097455c0 19.013818-15.546182 34.56-34.56 34.56z" fill="#0094F1" p-id="8866"></path></svg>
title: 多页面框架
details: 支持模板,快速实现多页面框架程序开发
- icon: <svg t="1726975282638" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="14568" width="32" height="32"><path d="M361.6768 891.5456a58.9824 58.9824 0 0 0 59.0336 58.9824c18.2272 0 28.5696-6.656 39.3216-19.6608L778.24 613.0176c24.2688-21.0944 55.1936-15.36 92.7232-16.7424 25.0368 2.304 53.4016-18.3808 74.8544-40.448 18.5856-22.2208 47.6672-67.1744 45.4656-101.4784-3.1744-9.4208-9.5232-12.6464-26.8288 0l-61.44 37.888c-28.3136 14.1824-54.1184-9.9328-65.3312-31.3344-11.8784-22.784-21.4016-52.3264 12.3392-76.1344l68.7104-40.6016c6.9632-3.9424 2.9696-12.1856-1.6896-14.0288-69.1712-18.688-122.0608-8.0896-165.888 31.232-19.1488 17.7664-25.6 40.3968-25.088 73.7792 0 36.9152-4.096 73.8304-25.6 98.2528l-319.1296 318.8224c-7.6288 9.8816-19.6608 25.6-19.6608 39.3216z m39.3216-9.8304A29.5424 29.5424 0 1 1 430.592 911.36a29.5424 29.5424 0 0 1-29.5936-29.5424z" fill="#FF775C" p-id="14569"></path><path d="M365.568 836.864l1.792-2.4576 182.3744-182.8864H163.84c-29.952 0-59.2384 30.464-59.2384 60.416v89.9072c0 29.952 29.2864 59.4944 59.2384 59.4944h185.4464a176.6912 176.6912 0 0 1 16.2816-24.4736z m401.3056-184.32L558.08 861.3376h204.8c29.9008 0 60.3648-29.5424 60.3648-59.4944v-89.856c0-28.7744-27.7504-56.9344-56.32-59.2896zM687.6672 516.608c17.2032-19.6096 19.6096-55.5008 19.7632-84.48 0-6.144 0-12.2368 0.5632-18.3808H163.84c-30.0032 0-59.2896 30.72-59.2896 60.928v90.5728c0 30.1568 29.2864 60.0064 59.2384 60.0064h415.744l108.032-108.6464z m51.8144-174.08a169.3696 169.3696 0 0 1 83.8656-43.1616V233.1648c0-30.208-30.3616-59.0848-60.3648-59.0848H163.84c-29.9008 0-59.2384 28.8768-59.2384 59.0848v90.5216C104.6528 353.8432 133.9904 384 163.84 384h549.4784a96.9216 96.9216 0 0 1 26.1632-41.6256z" fill="#FF775C" p-id="14570"></path><path d="M162.304 231.7824H225.28V321.536H162.304z m0 239.2576H225.28v91.4432H162.304z m0 242.7904H225.28V803.84H162.304z" fill="#FFFFFF" p-id="14571"></path></svg>
title: 扩展类库
details: 内置工具类库、扩展类库,提供便捷的使用体验
---

68
docs/install.md Normal file
View File

@ -0,0 +1,68 @@
# 安装
---
- **1、Nuget安装**
Nuget安装是Visual Studio引用控件包最方便快捷的方法。
**推荐使用该方法通过Nuget引用安装后工具箱会自动添加SunnyUI控件。**
安装方法一通过PM命令安装
PM>`Install-Package SunnyUI`
安装方法二通过Nuget包管理器搜索SunnyUI安装
![输入图片说明](./assets/f6dce88d_416720.png)
- **2、下载安装**
打开SunnyUI的码云地址[https://gitee.com/yhuse/SunnyUI](https://gitee.com/yhuse/SunnyUI)
点击“克隆/下载”点击“下载ZIP”根据提示下载SunnyUI。
![enter image description here](./assets/223010_76cd4ac9_416720.png)
下载yhuse-SunnyUI-master.zip然后解压直接引用已经编译好的dll文件
路径为SunnyUI\SunnyUI.Demo\Bin\SunnyUI.dllSunnyUI\SunnyUI.Demo\Bin\SunnyUI.Common.dll这两个项目都必须引用。再说一句还是推荐nuget引用。
新建Winform项目或者打开您已有的Winform项目选择窗体显示窗体设计器界面
点击“视图”-“工具箱”,显示工具箱,如下图:
![enter image description here](./assets/223028_c2e448fb_416720.png)
在工具箱,点击鼠标右键,添加选项卡
![enter image description here](./assets/223037_2d7d4804_416720.png)
输入SunnyUI
![enter image description here](./assets/223050_8c94ab32_416720.png)
在工具箱中选中选中SunnyUI选项卡。
- 安装方法一:
根据提示“此组中没有可用的控件。将某项拖至此文本可将其添加到工具箱”,
拖动SunnyUI\SunnyUI.Demo\Bin\SunnyUI.dll到提示文字会自动安装SunnyUI控件。
![enter image description here](./assets/223100_a6e9cf21_416720.png)
- 安装方法二:
点击鼠标右键,选择项
![enter image description here](./assets/223202_2f598874_416720.png)
在“.NET Framework 组件”页面点击“浏览”选择SunnyUI\SunnyUI.Demo\Bin\SunnyUI.dll
![enter image description here](./assets/223215_df2507fa_416720.png)
点击确定按钮将SunnyUI组件增加到选项卡
![enter image description here](./assets/223230_704d3f19_416720.png)
好的安装完成了开始使用SunnyUI控件吧~

Some files were not shown because too many files have changed in this diff Show More