wordpress网站可以显示中文和英文,临西做网站多少钱,怎么选一个适合自己的网站,内网建设网站需要什么条件HandyControl是一套WPF控件库#xff0c;它几乎重写了所有原生样式#xff0c;同时包含80余款自定义控件#xff08;正逐步增加#xff09;#xff0c;下面我们开始使用。
1、准备
1.1 创建项目
C# WPF应用(.NET Framework)创建项目
1.2 添加包 1.3 在App.xaml中引用…HandyControl是一套WPF控件库它几乎重写了所有原生样式同时包含80余款自定义控件正逐步增加下面我们开始使用。
1、准备
1.1 创建项目
C# WPF应用(.NET Framework)创建项目
1.2 添加包 1.3 在App.xaml中引用HandyControl的皮肤和主题
Application.ResourcesResourceDictionaryResourceDictionary.MergedDictionariesResourceDictionary Sourcepack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml/ResourceDictionary Sourcepack://application:,,,/HandyControl;component/Themes/Theme.xaml//ResourceDictionary.MergedDictionaries/ResourceDictionary
/Application.Resources1.4 窗体文件xaml添加引用
xmlns:hchttps://handyorg.github.io/handycontrol
2、窗体
2.1 改Window为hc:Window
hc:Window x:ClassHandyControlTest.MainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:dhttp://schemas.microsoft.com/expression/blend/2008xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006xmlns:hchttps://handyorg.github.io/handycontrolxmlns:localclr-namespace:HandyControlTestmc:IgnorabledTitleMainWindow Height450 Width800Grid/Grid
/hc:Window
2.2 修改窗体的xaml.cs文件
修改窗体类名否则报错“分部声明一定不能指定不同的基类”
public partial class MainWindow : Window ↓
public partial class MainWindow : HandyControl.Controls.Window 2.3 扩展属性 2.4 代码修改
CloseButtonBackgroundBlue CloseButtonForegroundWhite
CloseButtonHoverBackgroundRed CloseButtonHoverForegroundBlack
OtherButtonBackgroundGreen OtherButtonForegroundWhite
OtherButtonHoverBackgroundYellow OtherButtonHoverForegroundBlack 2.5 运行结果 2.6 其它参数 NonClientAreaBackground用来设置了标题栏的背景色。NonClientAreaForeground用来设置标题栏的前景色不仅仅可以用来设置标题的前景色也可以设置NonClientAreaContent中控件的默认前景色。NonClientAreaHeight用来设置标题栏的高度。下面看一段代码
hc:Window x:ClassTestDemo.View.WindowTestxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:hchttps://handyorg.github.io/handycontrolTitleWindowTest Height200 Width400NonClientAreaBackground LightBlue NonClientAreaForegroundRedNonClientAreaHeight100hc:Window.NonClientAreaContent Border BorderThickness1 BorderBrushBlackStackPanel HorizontalAlignmentLeft OrientationHorizontalButton Margin5,0,0,0 Content登录/TextBlock Text服务未连接 VerticalAlignmentCenter Margin5,0,0,0 //StackPanel/Border/hc:Window.NonClientAreaContent
/hc:Window 运行效果 3、 按钮
3.1 代码
GridStackPanel OrientationVerticalStackPanel OrientationHorizontalButton Content按钮 Margin10,10 Width75Style{StaticResource ButtonBaseBaseStyle} ForegroundBlack /Button Content按钮 Margin10,10 Width75Style{StaticResource ButtonDanger} /Button Content按钮 Margin10,10 Width75Style{StaticResource ButtonDashedDanger} /Button Content按钮 Margin10,10 Width75Style{StaticResource ButtonDashedInfo} /Button Content按钮 Margin10,10 Width75Style{StaticResource ButtonInfo} /Button Content按钮 Margin10,10 Width75Style{StaticResource ButtonPrimary} //StackPanelStackPanel OrientationHorizontalButton Content按钮 Margin10,10 Width75Style{StaticResource ButtonWarning} /Button Content按钮 Margin10,10 Width75Style{StaticResource ButtonSuccess} /Button Content按钮 Margin10,10 Width75Style{StaticResource ButtonSuccess} hc:BorderElement.CornerRadius15/Button Content按钮 Margin10,10 Width75Style{StaticResource ButtonDanger.Small} /Button Margin10,10 Width45Style{StaticResource ButtonIcon} hc:IconElement.Geometry{StaticResource AddGeometry}ForegroundGreen/Button Margin10,10 Width45Style{StaticResource ButtonIcon} hc:IconElement.Geometry{StaticResource RemoveGeometry}ForegroundGreen/Button Margin10,10 Width45 Height45Style{StaticResource ButtonIcon} hc:IconElement.Geometry{StaticResource SuccessGeometry}ForegroundWhiteBackground{DynamicResource {x:Static SystemColors.HighlightBrushKey}}/Button Content按钮 Margin10,10 Width75Style{StaticResource ButtonWarning} hc:IconElement.Geometry{StaticResource SuccessGeometry}ForegroundBlack//StackPanel/StackPanel
/Grid3.2 运行效果