* IStyle:支持自定义主题
This commit is contained in:
parent
d040187d82
commit
5b7c07c51c
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
131
SunnyUI/.editorconfig
Normal file
131
SunnyUI/.editorconfig
Normal file
@ -0,0 +1,131 @@
|
||||
# Rules in this file were initially inferred by Visual Studio IntelliCode from the C:\Users\Administrator\source\repos\SunnyUI\SunnyUI\ codebase based on best match to current usage at 2021/7/15
|
||||
# You can modify the rules from these initially generated values to suit your own policies
|
||||
# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
|
||||
[*.cs]
|
||||
|
||||
|
||||
#Core editorconfig formatting - indentation
|
||||
|
||||
#use soft tabs (spaces) for indentation
|
||||
indent_style = space
|
||||
|
||||
#Formatting - indentation options
|
||||
|
||||
#indent switch case contents.
|
||||
csharp_indent_case_contents = true
|
||||
#indent switch labels
|
||||
csharp_indent_switch_labels = true
|
||||
|
||||
#Formatting - new line options
|
||||
|
||||
#place catch statements on a new line
|
||||
csharp_new_line_before_catch = true
|
||||
#place else statements on a new line
|
||||
csharp_new_line_before_else = true
|
||||
#require members of object initializers to be on the same line
|
||||
csharp_new_line_before_members_in_object_initializers = false
|
||||
#require braces to be on a new line for accessors, object_collection_array_initializers, methods, types, control_blocks, and properties (also known as "Allman" style)
|
||||
csharp_new_line_before_open_brace = accessors, object_collection_array_initializers, methods, types, control_blocks, properties
|
||||
#require elements of query expression clauses to be on the same line
|
||||
csharp_new_line_between_query_expression_clauses = false
|
||||
|
||||
#Formatting - organize using options
|
||||
|
||||
#sort System.* using directives alphabetically, and place them before other usings
|
||||
dotnet_sort_system_directives_first = true
|
||||
|
||||
#Formatting - spacing options
|
||||
|
||||
#require NO space between a cast and the value
|
||||
csharp_space_after_cast = false
|
||||
#require a space before the colon for bases or interfaces in a type declaration
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
#require a space after a keyword in a control flow statement such as a for loop
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
#require a space before the colon for bases or interfaces in a type declaration
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
#remove space within empty argument list parentheses
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
#remove space between method call name and opening parenthesis
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
#remove space within empty parameter list parentheses for a method declaration
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list.
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
|
||||
#Formatting - wrapping options
|
||||
|
||||
#leave code block on separate lines
|
||||
csharp_preserve_single_line_blocks = false
|
||||
#leave statements and member declarations on the same line
|
||||
csharp_preserve_single_line_statements = true
|
||||
|
||||
#Style - Code block preferences
|
||||
|
||||
#prefer no curly braces if allowed
|
||||
csharp_prefer_braces = false:suggestion
|
||||
|
||||
#Style - expression bodied member options
|
||||
|
||||
#prefer expression-bodied members for accessors
|
||||
csharp_style_expression_bodied_accessors = true:suggestion
|
||||
#prefer block bodies for constructors
|
||||
csharp_style_expression_bodied_constructors = false:suggestion
|
||||
#prefer block bodies for methods
|
||||
csharp_style_expression_bodied_methods = false:suggestion
|
||||
#prefer expression-bodied members for properties
|
||||
csharp_style_expression_bodied_properties = true:suggestion
|
||||
|
||||
#Style - expression level options
|
||||
|
||||
#prefer out variables to be declared inline in the argument list of a method call when possible
|
||||
csharp_style_inlined_variable_declaration = true:suggestion
|
||||
#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them
|
||||
dotnet_style_predefined_type_for_member_access = true:suggestion
|
||||
|
||||
#Style - Expression-level preferences
|
||||
|
||||
#prefer objects to not be initialized using object initializers
|
||||
dotnet_style_object_initializer = false:suggestion
|
||||
|
||||
#Style - implicit and explicit types
|
||||
|
||||
#prefer explicit type over var in all cases, unless overridden by another code style rule
|
||||
csharp_style_var_elsewhere = false:suggestion
|
||||
#prefer explicit type over var to declare variables with built-in system types such as int
|
||||
csharp_style_var_for_built_in_types = false:suggestion
|
||||
#prefer explicit type over var when the type is already mentioned on the right-hand side of a declaration
|
||||
csharp_style_var_when_type_is_apparent = false:suggestion
|
||||
|
||||
#Style - language keyword and framework type options
|
||||
|
||||
#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
|
||||
|
||||
#Style - modifier options
|
||||
|
||||
#prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods.
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
|
||||
|
||||
#Style - Modifier preferences
|
||||
|
||||
#when this rule is set to a list of modifiers, prefer the specified ordering.
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,static,override,readonly,virtual,extern,new,sealed:suggestion
|
||||
|
||||
#Style - Pattern matching
|
||||
|
||||
#prefer pattern matching instead of is expression with type casts
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
||||
|
||||
#Style - qualification options
|
||||
|
||||
#prefer events not to be prefaced with this. or Me. in Visual Basic
|
||||
dotnet_style_qualification_for_event = false:suggestion
|
||||
#prefer fields not to be prefaced with this. or Me. in Visual Basic
|
||||
dotnet_style_qualification_for_field = false:suggestion
|
||||
#prefer methods not to be prefaced with this. or Me. in Visual Basic
|
||||
dotnet_style_qualification_for_method = false:suggestion
|
||||
#prefer properties not to be prefaced with this. or Me. in Visual Basic
|
||||
dotnet_style_qualification_for_property = false:suggestion
|
@ -67,8 +67,8 @@ namespace Sunny.UI
|
||||
ShowText = false;
|
||||
ShowRect = false;
|
||||
|
||||
fillColor = UIStyles.Blue.AvatarFillColor;
|
||||
foreColor = UIStyles.Blue.AvatarForeColor;
|
||||
fillColor = UIStyles.GetStyleColor(UIStyle.Blue).AvatarFillColor;
|
||||
foreColor = UIStyles.GetStyleColor(UIStyle.Blue).AvatarForeColor;
|
||||
}
|
||||
|
||||
private int avatarSize = 60;
|
||||
|
@ -46,17 +46,17 @@ namespace Sunny.UI
|
||||
Height = 35;
|
||||
Cursor = Cursors.Hand;
|
||||
|
||||
foreHoverColor = UIStyles.Blue.ButtonForeHoverColor;
|
||||
forePressColor = UIStyles.Blue.ButtonForePressColor;
|
||||
foreSelectedColor = UIStyles.Blue.ButtonForeSelectedColor;
|
||||
foreHoverColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonForeHoverColor;
|
||||
forePressColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonForePressColor;
|
||||
foreSelectedColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonForeSelectedColor;
|
||||
|
||||
rectHoverColor = UIStyles.Blue.RectHoverColor;
|
||||
rectPressColor = UIStyles.Blue.RectPressColor;
|
||||
rectSelectedColor = UIStyles.Blue.RectSelectedColor;
|
||||
rectHoverColor = UIStyles.GetStyleColor(UIStyle.Blue).RectHoverColor;
|
||||
rectPressColor = UIStyles.GetStyleColor(UIStyle.Blue).RectPressColor;
|
||||
rectSelectedColor = UIStyles.GetStyleColor(UIStyle.Blue).RectSelectedColor;
|
||||
|
||||
fillHoverColor = UIStyles.Blue.ButtonFillHoverColor;
|
||||
fillPressColor = UIStyles.Blue.ButtonFillPressColor;
|
||||
fillSelectedColor = UIStyles.Blue.ButtonFillSelectedColor;
|
||||
fillHoverColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonFillHoverColor;
|
||||
fillPressColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonFillPressColor;
|
||||
fillSelectedColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonFillSelectedColor;
|
||||
SetStyle(ControlStyles.StandardDoubleClick, UseDoubleClick);
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,8 @@ namespace Sunny.UI
|
||||
base.Cursor = Cursors.Hand;
|
||||
ShowRect = false;
|
||||
Size = new Size(150, 29);
|
||||
foreColor = UIStyles.Blue.CheckBoxForeColor;
|
||||
fillColor = UIStyles.Blue.CheckBoxColor;
|
||||
foreColor = UIStyles.GetStyleColor(UIStyle.Blue).CheckBoxForeColor;
|
||||
fillColor = UIStyles.GetStyleColor(UIStyle.Blue).CheckBoxColor;
|
||||
SetStyle(ControlStyles.StandardDoubleClick, UseDoubleClick);
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 边框颜色
|
||||
/// </summary>
|
||||
protected Color rectColor = UIStyles.Blue.RectColor;
|
||||
protected Color rectColor = UIStyles.GetStyleColor(UIStyle.Blue).RectColor;
|
||||
|
||||
/// <summary>
|
||||
/// 字体颜色
|
||||
|
@ -97,7 +97,7 @@ namespace Sunny.UI
|
||||
|
||||
public class ContextMenuColorTable : ProfessionalColorTable
|
||||
{
|
||||
private UIBaseStyle StyleColor = UIStyles.Blue;
|
||||
private UIBaseStyle StyleColor = UIStyles.GetStyleColor(UIStyle.Blue);
|
||||
|
||||
public void SetStyleColor(UIBaseStyle color)
|
||||
{
|
||||
|
@ -549,22 +549,22 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 选中颜色
|
||||
/// </summary>
|
||||
protected Color fillSelectedColor = UIStyles.Blue.ButtonFillSelectedColor;
|
||||
protected Color fillSelectedColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonFillSelectedColor;
|
||||
|
||||
/// <summary>
|
||||
/// 边框颜色
|
||||
/// </summary>
|
||||
protected Color rectColor = UIStyles.Blue.RectColor;
|
||||
protected Color rectColor = UIStyles.GetStyleColor(UIStyle.Blue).RectColor;
|
||||
|
||||
/// <summary>
|
||||
/// 填充颜色
|
||||
/// </summary>
|
||||
protected Color fillColor = UIStyles.Blue.ButtonFillColor;
|
||||
protected Color fillColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonFillColor;
|
||||
|
||||
/// <summary>
|
||||
/// 字体颜色
|
||||
/// </summary>
|
||||
protected Color foreColor = UIStyles.Blue.ButtonForeColor;
|
||||
protected Color foreColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonForeColor;
|
||||
|
||||
/// <summary>
|
||||
/// 字体鼠标移上颜色
|
||||
@ -579,7 +579,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 字体不可用颜色
|
||||
/// </summary>
|
||||
protected Color foreDisableColor = UIStyles.Blue.ForeDisableColor;
|
||||
protected Color foreDisableColor = UIStyles.GetStyleColor(UIStyle.Blue).ForeDisableColor;
|
||||
|
||||
/// <summary>
|
||||
/// 边框鼠标移上颜色
|
||||
@ -594,7 +594,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 边框不可用颜色
|
||||
/// </summary>
|
||||
protected Color rectDisableColor = UIStyles.Blue.RectDisableColor;
|
||||
protected Color rectDisableColor = UIStyles.GetStyleColor(UIStyle.Blue).RectDisableColor;
|
||||
|
||||
/// <summary>
|
||||
/// 填充鼠标移上颜色
|
||||
@ -609,7 +609,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 填充不可用颜色
|
||||
/// </summary>
|
||||
protected Color fillDisableColor = UIStyles.Blue.FillDisableColor;
|
||||
protected Color fillDisableColor = UIStyles.GetStyleColor(UIStyle.Blue).FillDisableColor;
|
||||
|
||||
/// <summary>
|
||||
/// 设置选中颜色
|
||||
|
@ -47,12 +47,12 @@ namespace Sunny.UI
|
||||
RectSides = ToolStripStatusLabelBorderSides.None;
|
||||
Padding = new Padding(0, 8, 0, 3);
|
||||
|
||||
foreHoverColor = UIStyles.Blue.ButtonForeHoverColor;
|
||||
forePressColor = UIStyles.Blue.ButtonForePressColor;
|
||||
foreSelectedColor = UIStyles.Blue.ButtonForeSelectedColor;
|
||||
fillHoverColor = UIStyles.Blue.ButtonFillHoverColor;
|
||||
fillPressColor = UIStyles.Blue.ButtonFillPressColor;
|
||||
fillSelectedColor = UIStyles.Blue.ButtonFillSelectedColor;
|
||||
foreHoverColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonForeHoverColor;
|
||||
forePressColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonForePressColor;
|
||||
foreSelectedColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonForeSelectedColor;
|
||||
fillHoverColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonFillHoverColor;
|
||||
fillPressColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonFillPressColor;
|
||||
fillSelectedColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonFillSelectedColor;
|
||||
SetStyle(ControlStyles.StandardDoubleClick, UseDoubleClick);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ namespace Sunny.UI
|
||||
_style = UIStyle.Custom;
|
||||
}
|
||||
|
||||
private Color foreColor = UIStyles.Blue.LabelForeColor;
|
||||
private Color foreColor = UIStyles.GetStyleColor(UIStyle.Blue).LabelForeColor;
|
||||
|
||||
/// <summary>
|
||||
/// Tag字符串
|
||||
|
@ -34,8 +34,8 @@ namespace Sunny.UI
|
||||
SetStyleFlags(true, false);
|
||||
Size = new Size(360, 29);
|
||||
MinimumSize = new Size(2, 2);
|
||||
foreColor = UIStyles.Blue.LineForeColor;
|
||||
fillColor = UIStyles.Blue.PlainColor;
|
||||
foreColor = UIStyles.GetStyleColor(UIStyle.Blue).LineForeColor;
|
||||
fillColor = UIStyles.GetStyleColor(UIStyle.Blue).PlainColor;
|
||||
}
|
||||
|
||||
public enum LineDirection
|
||||
|
@ -37,9 +37,9 @@ namespace Sunny.UI
|
||||
public partial class UIPanel : UserControl, IStyleInterface
|
||||
{
|
||||
private int radius = 5;
|
||||
protected Color rectColor = UIStyles.Blue.RectColor;
|
||||
protected Color fillColor = UIStyles.Blue.PlainColor;
|
||||
protected Color foreColor = UIStyles.Blue.PanelForeColor;
|
||||
protected Color rectColor = UIStyles.GetStyleColor(UIStyle.Blue).RectColor;
|
||||
protected Color fillColor = UIStyles.GetStyleColor(UIStyle.Blue).PlainColor;
|
||||
protected Color foreColor = UIStyles.GetStyleColor(UIStyle.Blue).PanelForeColor;
|
||||
|
||||
public UIPanel()
|
||||
{
|
||||
|
@ -47,8 +47,8 @@ namespace Sunny.UI
|
||||
Cursor = Cursors.Hand;
|
||||
ShowRect = false;
|
||||
Size = new Size(150, 29);
|
||||
foreColor = UIStyles.Blue.CheckBoxForeColor;
|
||||
fillColor = UIStyles.Blue.CheckBoxColor;
|
||||
foreColor = UIStyles.GetStyleColor(UIStyle.Blue).CheckBoxForeColor;
|
||||
fillColor = UIStyles.GetStyleColor(UIStyle.Blue).CheckBoxColor;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
|
@ -39,8 +39,8 @@ namespace Sunny.UI
|
||||
public UIScrollingText()
|
||||
{
|
||||
SetStyleFlags(true, false);
|
||||
fillColor = UIStyles.Blue.PlainColor;
|
||||
foreColor = UIStyles.Blue.RectColor;
|
||||
fillColor = UIStyles.GetStyleColor(UIStyle.Blue).PlainColor;
|
||||
foreColor = UIStyles.GetStyleColor(UIStyle.Blue).RectColor;
|
||||
Reset();
|
||||
|
||||
timer.Interval = interval;
|
||||
|
@ -1730,22 +1730,22 @@ namespace Sunny.UI
|
||||
|
||||
public void ShowInfoNotifier(string desc, bool isDialog = false, int timeout = 2000)
|
||||
{
|
||||
UINotifierHelper.ShowNotifier(desc, UINotifierType.INFO, UILocalize.InfoTitle, false, timeout);
|
||||
UINotifierHelper.ShowNotifier(desc, UINotifierType.INFO, UILocalize.InfoTitle, isDialog, timeout);
|
||||
}
|
||||
|
||||
public void ShowSuccessNotifier(string desc, bool isDialog = false, int timeout = 2000)
|
||||
{
|
||||
UINotifierHelper.ShowNotifier(desc, UINotifierType.OK, UILocalize.SuccessTitle, false, timeout);
|
||||
UINotifierHelper.ShowNotifier(desc, UINotifierType.OK, UILocalize.SuccessTitle, isDialog, timeout);
|
||||
}
|
||||
|
||||
public void ShowWarningNotifier(string desc, bool isDialog = false, int timeout = 2000)
|
||||
{
|
||||
UINotifierHelper.ShowNotifier(desc, UINotifierType.WARNING, UILocalize.WarningTitle, false, timeout);
|
||||
UINotifierHelper.ShowNotifier(desc, UINotifierType.WARNING, UILocalize.WarningTitle, isDialog, timeout);
|
||||
}
|
||||
|
||||
public void ShowErrorNotifier(string desc, bool isDialog = false, int timeout = 2000)
|
||||
{
|
||||
UINotifierHelper.ShowNotifier(desc, UINotifierType.ERROR, UILocalize.ErrorTitle, false, timeout);
|
||||
UINotifierHelper.ShowNotifier(desc, UINotifierType.ERROR, UILocalize.ErrorTitle, isDialog, timeout);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -165,30 +165,30 @@ namespace Sunny.UI
|
||||
{
|
||||
case UINotifierType.ERROR:
|
||||
icon.Symbol = 61527;
|
||||
icon.SymbolColor = UIStyles.Red.ButtonFillColor;
|
||||
LeaveColor = UIStyles.Red.ButtonFillColor;
|
||||
HoverColor = UIStyles.Red.ButtonFillHoverColor;
|
||||
icon.SymbolColor = UIStyles.GetStyleColor(UIStyle.Red).ButtonFillColor;
|
||||
LeaveColor = UIStyles.GetStyleColor(UIStyle.Red).ButtonFillColor;
|
||||
HoverColor = UIStyles.GetStyleColor(UIStyle.Red).ButtonFillHoverColor;
|
||||
break;
|
||||
|
||||
case UINotifierType.INFO:
|
||||
icon.Symbol = 61530;
|
||||
icon.SymbolColor = UIStyles.Blue.ButtonFillColor;
|
||||
LeaveColor = UIStyles.Blue.ButtonFillColor;
|
||||
HoverColor = UIStyles.Blue.ButtonFillHoverColor;
|
||||
icon.SymbolColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonFillColor;
|
||||
LeaveColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonFillColor;
|
||||
HoverColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonFillHoverColor;
|
||||
break;
|
||||
|
||||
case UINotifierType.WARNING:
|
||||
icon.Symbol = 61553;
|
||||
icon.SymbolColor = UIStyles.Orange.ButtonFillColor;
|
||||
LeaveColor = UIStyles.Orange.ButtonFillColor;
|
||||
HoverColor = UIStyles.Orange.ButtonFillHoverColor;
|
||||
icon.SymbolColor = UIStyles.GetStyleColor(UIStyle.Orange).ButtonFillColor;
|
||||
LeaveColor = UIStyles.GetStyleColor(UIStyle.Orange).ButtonFillColor;
|
||||
HoverColor = UIStyles.GetStyleColor(UIStyle.Orange).ButtonFillHoverColor;
|
||||
break;
|
||||
|
||||
case UINotifierType.OK:
|
||||
icon.Symbol = 61528;
|
||||
icon.SymbolColor = UIStyles.Green.ButtonFillColor;
|
||||
LeaveColor = UIStyles.Green.ButtonFillColor;
|
||||
HoverColor = UIStyles.Green.ButtonFillHoverColor;
|
||||
icon.SymbolColor = UIStyles.GetStyleColor(UIStyle.Green).ButtonFillColor;
|
||||
LeaveColor = UIStyles.GetStyleColor(UIStyle.Green).ButtonFillColor;
|
||||
HoverColor = UIStyles.GetStyleColor(UIStyle.Green).ButtonFillHoverColor;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -105,8 +105,8 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 紫
|
||||
/// </summary>
|
||||
//[DisplayText("Purple")]
|
||||
//Purple = 9,
|
||||
[DisplayText("Purple")]
|
||||
Purple = 9,
|
||||
|
||||
/// <summary>
|
||||
/// Office蓝
|
||||
@ -154,7 +154,19 @@ namespace Sunny.UI
|
||||
/// 浅灰
|
||||
/// </summary>
|
||||
[DisplayText("LightGray")]
|
||||
LightGray = 205
|
||||
LightGray = 205,
|
||||
|
||||
/// <summary>
|
||||
/// 浅紫
|
||||
/// </summary>
|
||||
[DisplayText("LightPurple")]
|
||||
LightPurple = 209,
|
||||
|
||||
/// <summary>
|
||||
/// 多彩的
|
||||
/// </summary>
|
||||
[DisplayText("Colorful")]
|
||||
Colorful = 999
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -179,89 +191,109 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义
|
||||
/// </summary>
|
||||
public static UIBaseStyle Custom = new UICustomStyle();
|
||||
private readonly static UIBaseStyle Custom = new UICustomStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 白
|
||||
/// </summary>
|
||||
public static UIBaseStyle White = new UIWhiteStyle();
|
||||
private readonly static UIBaseStyle White = new UIWhiteStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 蓝
|
||||
/// </summary>
|
||||
public static UIBaseStyle Blue = new UIBlueStyle();
|
||||
private readonly static UIBaseStyle Blue = new UIBlueStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 浅蓝
|
||||
/// </summary>
|
||||
public static UIBaseStyle LightBlue = new UILightBlueStyle();
|
||||
private readonly static UIBaseStyle LightBlue = new UILightBlueStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 橙
|
||||
/// </summary>
|
||||
public static UIBaseStyle Orange = new UIOrangeStyle();
|
||||
private readonly static UIBaseStyle Orange = new UIOrangeStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 浅橙
|
||||
/// </summary>
|
||||
public static UIBaseStyle LightOrange = new UILightOrangeStyle();
|
||||
private readonly static UIBaseStyle LightOrange = new UILightOrangeStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 灰
|
||||
/// </summary>
|
||||
public static UIBaseStyle Gray = new UIGrayStyle();
|
||||
private readonly static UIBaseStyle Gray = new UIGrayStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 浅灰
|
||||
/// </summary>
|
||||
public static UIBaseStyle LightGray = new UILightGrayStyle();
|
||||
private readonly static UIBaseStyle LightGray = new UILightGrayStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 绿
|
||||
/// </summary>
|
||||
public static UIBaseStyle Green = new UIGreenStyle();
|
||||
private readonly static UIBaseStyle Green = new UIGreenStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 浅绿
|
||||
/// </summary>
|
||||
public static UIBaseStyle LightGreen = new UILightGreenStyle();
|
||||
private readonly static UIBaseStyle LightGreen = new UILightGreenStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 红
|
||||
/// </summary>
|
||||
public static UIBaseStyle Red = new UIRedStyle();
|
||||
private readonly static UIBaseStyle Red = new UIRedStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 浅红
|
||||
/// </summary>
|
||||
public static UIBaseStyle LightRed = new UILightRedStyle();
|
||||
private readonly static UIBaseStyle LightRed = new UILightRedStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 深蓝
|
||||
/// </summary>
|
||||
public static UIBaseStyle DarkBlue = new UIDarkBlueStyle();
|
||||
private readonly static UIBaseStyle DarkBlue = new UIDarkBlueStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 黑
|
||||
/// </summary>
|
||||
public static UIBaseStyle Black = new UIBlackStyle();
|
||||
private readonly static UIBaseStyle Black = new UIBlackStyle();
|
||||
|
||||
/// <summary>
|
||||
/// Office蓝
|
||||
/// </summary>
|
||||
public static UIBaseStyle Office2010Blue = new UIOffice2010BlueStyle();
|
||||
private readonly static UIBaseStyle Office2010Blue = new UIOffice2010BlueStyle();
|
||||
|
||||
/// <summary>
|
||||
/// Office银
|
||||
/// </summary>
|
||||
public static UIBaseStyle Office2010Silver = new UIOffice2010SilverStyle();
|
||||
private readonly static UIBaseStyle Office2010Silver = new UIOffice2010SilverStyle();
|
||||
|
||||
public static UIBaseStyle PurpleStyle = new UIPurpleStyle();
|
||||
/// <summary>
|
||||
/// 紫
|
||||
/// </summary>
|
||||
private readonly static UIBaseStyle Purple = new UIPurpleStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 浅紫
|
||||
/// </summary>
|
||||
private readonly static UIBaseStyle LightPurple = new UILightPurpleStyle();
|
||||
|
||||
/// <summary>
|
||||
/// 多彩
|
||||
/// </summary>
|
||||
private readonly static UIColorfulStyle Colorful = new UIColorfulStyle();
|
||||
|
||||
/// <summary>
|
||||
/// Office黑
|
||||
/// </summary>
|
||||
public static UIBaseStyle Office2010Black = new UIOffice2010BlackStyle();
|
||||
private readonly static UIBaseStyle Office2010Black = new UIOffice2010BlackStyle();
|
||||
|
||||
public static void InitColorful(Color styleColor, Color foreColor)
|
||||
{
|
||||
Colorful.Init(styleColor, foreColor);
|
||||
Style = UIStyle.Colorful;
|
||||
SetStyle(Style);
|
||||
}
|
||||
|
||||
private static readonly ConcurrentDictionary<UIStyle, UIBaseStyle> Styles = new ConcurrentDictionary<UIStyle, UIBaseStyle>();
|
||||
private static readonly ConcurrentDictionary<Guid, UIForm> Forms = new ConcurrentDictionary<Guid, UIForm>();
|
||||
@ -288,10 +320,12 @@ namespace Sunny.UI
|
||||
AddStyle(DarkBlue);
|
||||
AddStyle(Black);
|
||||
AddStyle(White);
|
||||
//AddStyle(PurpleStyle);
|
||||
AddStyle(Purple);
|
||||
AddStyle(LightPurple);
|
||||
AddStyle(Office2010Blue);
|
||||
AddStyle(Office2010Silver);
|
||||
AddStyle(Office2010Black);
|
||||
AddStyle(Colorful);
|
||||
|
||||
MenuColors.TryAdd(UIMenuStyle.Custom, new UIMenuCustomColor());
|
||||
MenuColors.TryAdd(UIMenuStyle.Black, new UIMenuBlackColor());
|
||||
|
@ -24,30 +24,29 @@ using System.Drawing;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
public abstract class UIBaseStyle
|
||||
public class UIBaseStyle
|
||||
{
|
||||
public abstract UIStyle Name { get; }
|
||||
public virtual UIStyle Name { get; protected set; }
|
||||
|
||||
public virtual Color PrimaryColor { get; protected set; }
|
||||
public virtual Color RegularColor { get; protected set; }
|
||||
public virtual Color SecondaryColor { get; protected set; }
|
||||
public virtual Color PlainColor { get; protected set; }
|
||||
|
||||
public abstract Color RectColor { get; }
|
||||
public abstract Color RectHoverColor { get; }
|
||||
public abstract Color RectPressColor { get; }
|
||||
|
||||
public abstract Color RectSelectedColor { get; }
|
||||
public abstract Color ButtonForeSelectedColor { get; }
|
||||
public abstract Color ButtonFillSelectedColor { get; }
|
||||
public virtual Color RectColor { get; protected set; }
|
||||
public virtual Color RectHoverColor { get; protected set; }
|
||||
public virtual Color RectPressColor { get; protected set; }
|
||||
public virtual Color RectSelectedColor { get; protected set; }
|
||||
|
||||
public virtual Color ButtonFillColor { get; protected set; }
|
||||
public virtual Color ButtonFillHoverColor { get; protected set; }
|
||||
public virtual Color ButtonFillPressColor { get; protected set; }
|
||||
public virtual Color ButtonFillSelectedColor { get; protected set; }
|
||||
|
||||
public abstract Color ButtonForeColor { get; }
|
||||
public abstract Color ButtonForeHoverColor { get; }
|
||||
public abstract Color ButtonForePressColor { get; }
|
||||
public virtual Color ButtonForeColor { get; protected set; }
|
||||
public virtual Color ButtonForeHoverColor { get; protected set; }
|
||||
public virtual Color ButtonForePressColor { get; protected set; }
|
||||
public virtual Color ButtonForeSelectedColor { get; protected set; }
|
||||
|
||||
public virtual Color FillDisableColor => Color.FromArgb(244, 244, 244);
|
||||
public virtual Color RectDisableColor => Color.FromArgb(173, 178, 181);
|
||||
@ -64,10 +63,10 @@ namespace Sunny.UI
|
||||
|
||||
public virtual Color DropDownControlColor => PanelForeColor;
|
||||
|
||||
public abstract Color TitleColor { get; }
|
||||
public abstract Color TitleForeColor { get; }
|
||||
public virtual Color TitleColor { get; protected set; }
|
||||
public virtual Color TitleForeColor { get; protected set; }
|
||||
|
||||
public virtual Color MenuSelectedColor => UIColor.Blue;
|
||||
public virtual Color MenuSelectedColor { get; protected set; } = UIColor.Blue;
|
||||
|
||||
public virtual Color GridSelectedColor { get; protected set; } = Color.FromArgb(155, 200, 255);
|
||||
|
||||
@ -124,13 +123,12 @@ namespace Sunny.UI
|
||||
{
|
||||
return Name.DisplayText();
|
||||
}
|
||||
}
|
||||
|
||||
public class UIPurpleStyle : UIBaseStyle
|
||||
protected virtual void Init(Color color, UIStyle style, Color foreColor)
|
||||
{
|
||||
public UIPurpleStyle()
|
||||
{
|
||||
PrimaryColor = UIColor.Purple;
|
||||
Name = style;
|
||||
|
||||
MenuSelectedColor = TitleColor = RectColor = PrimaryColor = color;
|
||||
Color[] colors = GDIEx.GradientColors(Color.White, PrimaryColor, 16);
|
||||
Color[] colors1 = GDIEx.GradientColors(PrimaryColor, Color.Black, 16);
|
||||
PlainColor = colors[1];
|
||||
@ -138,35 +136,55 @@ namespace Sunny.UI
|
||||
RegularColor = colors[10];
|
||||
|
||||
ButtonFillColor = PrimaryColor;
|
||||
ButtonFillHoverColor = colors[12];
|
||||
ButtonFillPressColor = colors1[3];
|
||||
RectHoverColor = ButtonFillHoverColor = colors[12];
|
||||
RectSelectedColor = RectPressColor = ButtonFillSelectedColor = ButtonFillPressColor = colors1[3];
|
||||
GridSelectedColor = colors[3];
|
||||
|
||||
ButtonForeColor = ButtonForeHoverColor = ButtonForePressColor = ButtonForeSelectedColor = TitleForeColor = foreColor;
|
||||
}
|
||||
|
||||
public override UIStyle Name => UIStyle.Blue;
|
||||
protected virtual void InitPlain(Color color, UIStyle style, Color foreColor)
|
||||
{
|
||||
Name = style;
|
||||
MenuSelectedColor = RectColor = RectHoverColor = TitleColor = ButtonForeColor = ButtonFillHoverColor = PrimaryColor = color;
|
||||
Color[] colors = GDIEx.GradientColors(Color.White, PrimaryColor, 16);
|
||||
Color[] colors1 = GDIEx.GradientColors(PrimaryColor, Color.Black, 16);
|
||||
ButtonFillColor = PlainColor = colors[1];
|
||||
SecondaryColor = colors[5];
|
||||
RegularColor = colors[10];
|
||||
ButtonFillSelectedColor = RectPressColor = RectSelectedColor = ButtonFillPressColor = colors1[3];
|
||||
GridSelectedColor = colors[3];
|
||||
ButtonForeHoverColor = ButtonForePressColor = ButtonForeSelectedColor = TitleForeColor = foreColor;
|
||||
}
|
||||
}
|
||||
|
||||
public override Color PrimaryColor { get; protected set; }
|
||||
public override Color RegularColor { get; protected set; }
|
||||
public override Color SecondaryColor { get; protected set; }
|
||||
public override Color PlainColor { get; protected set; }
|
||||
public class UIPurpleStyle : UIBaseStyle
|
||||
{
|
||||
public UIPurpleStyle()
|
||||
{
|
||||
Init(UIColor.Purple, UIStyle.Purple, Color.White);
|
||||
}
|
||||
}
|
||||
|
||||
public override Color ButtonFillColor { get; protected set; }
|
||||
public override Color ButtonFillHoverColor { get; protected set; }
|
||||
public override Color ButtonFillPressColor { get; protected set; }
|
||||
public class UILightPurpleStyle : UIBaseStyle
|
||||
{
|
||||
public UILightPurpleStyle()
|
||||
{
|
||||
InitPlain(UIColor.Purple, UIStyle.LightPurple, Color.White);
|
||||
}
|
||||
}
|
||||
|
||||
public override Color ButtonForeColor => Color.White;
|
||||
public override Color ButtonForeHoverColor => Color.White;
|
||||
public override Color ButtonForePressColor => Color.White;
|
||||
public override Color RectSelectedColor => RectPressColor;
|
||||
public override Color ButtonForeSelectedColor => ButtonForePressColor;
|
||||
public override Color ButtonFillSelectedColor => ButtonFillPressColor;
|
||||
public override Color RectColor => UIColor.Purple;
|
||||
public override Color RectHoverColor => ButtonFillHoverColor;
|
||||
public override Color RectPressColor => ButtonFillPressColor;
|
||||
public override Color TitleColor => UIColor.Purple;
|
||||
public override Color TitleForeColor => Color.White;
|
||||
public override Color MenuSelectedColor => UIColor.Purple;
|
||||
public override Color GridSelectedColor { get; protected set; }
|
||||
public class UIColorfulStyle : UIBaseStyle
|
||||
{
|
||||
public UIColorfulStyle()
|
||||
{
|
||||
Init(Color.FromArgb(0, 190, 172), UIStyle.Colorful, Color.White);
|
||||
}
|
||||
|
||||
public void Init(Color styleColor, Color foreColor)
|
||||
{
|
||||
Init(styleColor, UIStyle.Colorful, foreColor);
|
||||
}
|
||||
}
|
||||
|
||||
public class UICustomStyle : UIBlueStyle
|
||||
|
@ -44,6 +44,14 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
public void Render()
|
||||
{
|
||||
if (Style != UIStyle.Custom)
|
||||
{
|
||||
UIStyles.SetStyle(Style);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
|
@ -44,6 +44,7 @@
|
||||
<None Remove="Font\fa-solid-900.ttf" />
|
||||
<None Remove="Font\FontAwesome.ttf" />
|
||||
<None Remove="Style\UIStyleColor.cs~RF1472b803.TMP" />
|
||||
<None Remove="Style\UIStyleColor.cs~RF22754f9d.TMP" />
|
||||
<None Include="..\LICENSE">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath></PackagePath>
|
||||
|
Loading…
x
Reference in New Issue
Block a user