雅安市建设局网站,移动商城个人中心手机卡进度查询,专业的建设企业网站公司,江门市住房城乡建设局网站一个简单登录界面 文章目录 一个简单登录界面一、效果展示二、准备代码 一、效果展示 二、准备代码
创建一个WPF工程#xff0c;创建名为 Login5 的WPF项目。 添加Nuget包
MaterialDesignThemes
界面的整体布局和样式代码
Window x:ClassLogin5.MainWindow创建名为 Login5 的WPF项目。 添加Nuget包
MaterialDesignThemes
界面的整体布局和样式代码
Window x:ClassLogin5.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:materialDesignhttp://materialdesigninxaml.net/winfx/xaml/themesxmlns:localclr-namespace:Login5mc:IgnorabledTitleMainWindow Height450 Width800ResizeModeNoResize WindowStartupLocationCenterScreenWindowStyleNoneWindow.ResourcesResourceDictionaryResourceDictionary.MergedDictionariesResourceDictionary Sourcepack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml/ResourceDictionary Sourcepack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml /ResourceDictionary Sourcepack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Red.xaml /ResourceDictionary Sourcepack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml //ResourceDictionary.MergedDictionaries/ResourceDictionary/Window.ResourcesGrid MouseDownGrid_MouseDownGrid.BackgroundLinearGradientBrush StartPoint0.1,0 EndPoint0.9,1GradientStop Offset1 Color#FFE63070/GradientStop Offset0 Color#FFFE8704//LinearGradientBrush/Grid.BackgroundBorder Height390 VerticalAlignmentTop Background#100E17 CornerRadius0 0 180 0StackPanel OrientationHorizontalStackPanel Width350Image Width300 Height300 Margin30 VerticalAlignmentTop StretchFill Sourcepack://application:,,,/Login5;component/Images/left.png//StackPanelStackPanel Width350StackPanel Margin20,40TextBlock Margin20 FontFamilyGreat VibesFontSize38 ForegroundWhite TextAlignmentCenter用户登录/TextBlockStackPanel Margin10 OrientationHorizontalmaterialDesign:PackIconWidth25 Height25 ForegroundWhiteKindUser/TextBox x:NametxtUserName Width250Margin10,0 BorderBrushWhiteCaretBrush#FFD94448 ForegroundWhiteSelectionBrush#FFD94448materialDesign:HintAssist.Hint输入 用户名 / 邮箱//StackPanelStackPanel Margin10 OrientationHorizontalmaterialDesign:PackIconWidth25 Height25 ForegroundWhiteKindLock/PasswordBox x:NametxtPassword Width250Margin10,0 BorderBrushWhiteCaretBrush#FFD94448 ForegroundWhiteSelectionBrush#FFD94448materialDesign:HintAssist.Hint********//StackPanelStackPanel Margin10 HorizontalAlignmentCenterButton x:NamebtnLogin Width100 Height40materialDesign:ButtonAssist.CornerRadius10Background#D94448 BorderBrush#D94448 BorderThickness2Content登录 ForegroundWhite ToolTip登录Style{StaticResource MaterialDesignRaisedButton}//StackPanel/StackPanel/StackPanelStackPanel Width100Button x:NamebtnExit Margin10,20 Background{x:Null}ClickbtnExit_Click Style{StaticResource MaterialDesignFloatingActionButton}ToolTip关闭materialDesign:PackIcon Width30 Height30 ForegroundWhite KindClose//Button/StackPanel/StackPanel/Border/Grid
/WindowMainWindow.xaml.cs
using System.Windows;
using System.Windows.Input;namespace Login5
{/// summary/// Interaction logic for MainWindow.xaml/// /summarypublic partial class MainWindow : Window{public MainWindow(){InitializeComponent();}private void btnExit_Click(object sender, RoutedEventArgs e){this.Close();}private void Grid_MouseDown(object sender, MouseButtonEventArgs e){if(Mouse.LeftButton MouseButtonState.Pressed){this.DragMove();}}}
}