首页 > 其他分享 >WPF登录界面样例

WPF登录界面样例

时间:2024-04-06 21:13:50浏览次数:19  
标签:215 界面 登录 样例 WPF 224

XAML文件内容如下

  1 <Window x:Class="ERP.Views.Login"
  2         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6         xmlns:local="clr-namespace:ERP.Views"
  7         mc:Ignorable="d"
  8         WindowStyle="None"
  9         ResizeMode="NoResize"
 10         WindowStartupLocation="CenterScreen"
 11         MouseDown="Window_MouseDown"
 12         Background="Transparent"
 13         AllowsTransparency="True"
 14         Title="Login" Height="550" Width="800">
 15     <Border CornerRadius="12">
 16         <Border.Background>
 17             <ImageBrush ImageSource="/resource/login_background.png" Stretch="None"/>
 18         </Border.Background>
 19         <Border CornerRadius="10" BorderThickness="1" Opacity="0.9">
 20             <Border.BorderBrush>
 21                 <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
 22                     <GradientStop Color="#462ad8" Offset="0"/>
 23                     <GradientStop Color="#da34a1" Offset="0.75"/>
 24                     <GradientStop Color="#8a16c1" Offset="1"/>
 25                 </LinearGradientBrush>
 26             </Border.BorderBrush>
 27             <Border.Background>
 28                 <LinearGradientBrush StartPoint="0,1" EndPoint="1,0">
 29                     <GradientStop Color="#060531" Offset="0"/>
 30                     <GradientStop Color="#1b1448" Offset="0.75"/>
 31                 </LinearGradientBrush>
 32             </Border.Background>
 33             <Grid>
 34                 <Grid.RowDefinitions>
 35                     <RowDefinition Height="30"/>
 36                     <RowDefinition/>
 37                 </Grid.RowDefinitions>
 38                 <Grid>
 39                     <Grid.ColumnDefinitions>
 40                         <ColumnDefinition/>
 41                         <ColumnDefinition Width="25"/>
 42                         <ColumnDefinition Width="25"/>
 43                         <ColumnDefinition Width="5"/>
 44                     </Grid.ColumnDefinitions>
 45                     <TextBlock Text="登录"  
 46                                Foreground="#cccccc" 
 47                                FontSize="10"
 48                                FontFamily="Montserrat" 
 49                                Grid.Column="0" 
 50                                VerticalAlignment="Center"
 51                                Margin="10 0 0 0"/>
 52                     <Button x:Name="btnMinimize" 
 53                             Grid.Column="1" 
 54                             Content="-" 
 55                             FontSize="16" 
 56                             Foreground="White" 
 57                             FontFamily="Montserrat" 
 58                             Cursor="Hand"
 59                             Click="btnMinimize_Click">
 60                         <Button.Style>
 61                             <Style TargetType="Button">
 62                                 <Setter Property="Background" Value="#28aeed"/>
 63                                 <Style.Triggers>
 64                                     <Trigger Property="IsMouseOver" Value="True">
 65                                         <Setter Property="Background" Value="#278bef"/>
 66                                     </Trigger>
 67                                 </Style.Triggers>
 68                             </Style>
 69                         </Button.Style>
 70                         <Button.Template>
 71                             <ControlTemplate TargetType="Button">
 72                                 <Border Width="18" Height="18" CornerRadius="9" Background="{TemplateBinding Background}">
 73                                     <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
 74                                 </Border>
 75                             </ControlTemplate>
 76                         </Button.Template>
 77                     </Button>
 78                     <Button x:Name="btnClose" 
 79                             Grid.Column="2" 
 80                             Content="X" 
 81                             FontSize="16" 
 82                             Foreground="White" 
 83                             FontFamily="Montserrat" 
 84                             Cursor="Hand"
 85                             Click="btnClose_Click">
 86                         <Button.Style>
 87                             <Style TargetType="Button">
 88                                 <Setter Property="Background" Value="#da34ae"/>
 89                                 <Style.Triggers>
 90                                     <Trigger Property="IsMouseOver" Value="True">
 91                                         <Setter Property="Background" Value="#c62dae"/>
 92                                     </Trigger>
 93                                 </Style.Triggers>
 94                             </Style>
 95                         </Button.Style>
 96                         <Button.Template>
 97                             <ControlTemplate TargetType="Button">
 98                                 <Border Width="18" Height="18" CornerRadius="9" Background="{TemplateBinding Background}">
 99                                     <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
100                                 </Border>
101                             </ControlTemplate>
102                         </Button.Template>
103                     </Button>
104                 </Grid>
105                 <StackPanel Width="250"
106                             Margin="0 35 0 0"
107                             Grid.Row="1">
108                     <Image Source="/resource/login_logo.png"
109                            Width="100"
110                            Height="100"/>
111                     <TextBlock Text="ERP"
112                         Foreground="White"
113                         FontSize="25"
114                         FontWeight="Medium"
115                         FontFamily="Montserrat"
116                         HorizontalAlignment="Center"
117                         />
118                     <TextBlock
119                         Text="ERP系统,优化流程,精准决策,引领企业迈向数字化管理新时代!"
120                         Foreground="LightGray"
121                         FontSize="12"
122                         FontWeight="Medium"
123                         FontFamily="Montserrat"
124                         TextWrapping="Wrap"
125                         TextAlignment="Center"
126                         Margin="0 5 0 0"
127                         />
128                     <TextBlock Text="用户名"
129                         Foreground="DarkGray"
130                         FontSize="12"
131                         FontWeight="Medium"
132                         FontFamily="Montserrat"
133                         Margin="0 35 0 0"
134                         />
135                     <TextBox x:Name="txtUser"
136                              FontSize="13"
137                              FontWeight="Medium"
138                              FontFamily="Montserrat"
139                              Foreground="White"
140                              CaretBrush="LightGray"
141                              BorderBrush="DarkGray"
142                              BorderThickness="0 0 0 1"
143                              Height="28"
144                              VerticalContentAlignment="Center"
145                              Margin="0 5 0 0"
146                              Padding="35 0 0 0"
147                         >
148                         <TextBox.Background>
149                             <ImageBrush ImageSource="/resource/登录.png"
150                                         Stretch="Uniform"
151                                         AlignmentX="Left"/>
152                         </TextBox.Background>
153                     </TextBox>
154                     <TextBlock Text="密码"
155                         Foreground="DarkGray"
156                         FontSize="12"
157                         FontWeight="Medium"
158                         FontFamily="Montserrat"
159                         Margin="0 15 0 0"
160                         />
161                     <PasswordBox x:Name="txtPassword"
162                              FontSize="13"
163                              FontWeight="Medium"
164                              FontFamily="Montserrat"
165                              Foreground="White"
166                              CaretBrush="LightGray"
167                              BorderBrush="DarkGray"
168                              BorderThickness="0 0 0 1"
169                              Height="28"
170                              VerticalContentAlignment="Center"
171                              Margin="0 5 0 0"
172                              Padding="35 0 0 0"
173                         >
174                         <PasswordBox.Background>
175                             <ImageBrush ImageSource="/resource/登录密码.png"
176                                         Stretch="Uniform"
177                                         AlignmentX="Left"/>
178                         </PasswordBox.Background>
179                     </PasswordBox>
180                     <Button x:Name="btnLogin" 
181                             Content="登录"
182                             FontSize="16" 
183                             Foreground="White" 
184                             FontFamily="Montserrat" 
185                             Cursor="Hand"
186                             Margin="0,50,0,0"
187                             Click="Button_Click">
188                             <Button.Style>
189                                 <Style TargetType="Button">
190                                     <Setter Property="Background" Value="#462ad8"/>
191                                     <Style.Triggers>
192                                         <Trigger Property="IsMouseOver" Value="True">
193                                             <Setter Property="Background" Value="#28aeed"/>
194                                         </Trigger>
195                                     </Style.Triggers>
196                                 </Style>
197                             </Button.Style>
198                         <Button.Template>
199                             <ControlTemplate TargetType="Button">
200                                 <Border Width="150" Height="40" CornerRadius="20" Background="{TemplateBinding Background}">
201                                     <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
202                                 </Border>
203                             </ControlTemplate>
204                         </Button.Template>
205                     </Button>
206                     <StackPanel Orientation="Horizontal"
207                                 HorizontalAlignment="Center"
208                                 Margin="0,15,0,0">
209                         <TextBlock Text="忘记了密码?" 
210                                    Foreground="DarkGray"
211                                    FontSize="12"
212                                    FontWeight="Medium"
213                                    FontFamily="Montserrat"
214                                    Cursor="Hand"/>
215                         <TextBlock Text="重置密码"
216                                    Foreground="White"
217                                    FontSize="12"
218                                    FontWeight="Medium"
219                                    FontFamily="Montserrat"
220                                    Cursor="Hand"
221                                    Margin="8,0,0,0"/>
222                     </StackPanel>
223                 </StackPanel>
224             </Grid>
225         </Border>
226     </Border>
227 </Window>
View Code

效果图

资源

背景图

 

 logo

图标

 

标签:215,界面,登录,样例,WPF,224
From: https://www.cnblogs.com/ggtc/p/18117935

相关文章

  • 在RichTextBox mvvm中使用wpf工具包在插入符号处插入文本
    ,可以通过以下步骤实现:首先,确保你已经在项目中引用了WPF工具包。可以通过在VisualStudio中的项目引用中添加对WPF工具包的引用来完成。在你的MVVM模式中,创建一个名为"InsertTextCommand"的命令类,用于处理插入文本的逻辑。这个命令类应该实现ICommand接口,并且包含一个Execute方......
  • 【MATLAB源码-第170期】基于matlab的BP神经网络股票价格预测GUI界面附带详细文档说明
    操作环境:MATLAB2022a1、算法描述基于BP神经网络的股票价格预测是一种利用人工神经网络中的反向传播(Backpropagation,简称BP)算法来预测股票市场价格变化的技术。这种方法通过模拟人脑的处理方式,尝试捕捉股票市场中的复杂非线性关系,以实现对未来股价的预测。本文将详细介绍BP......
  • Go 实战|使用 Wails 构建轻量级的桌面应用:仿微信登录界面 Demo
    概述本文探讨Wails框架的使用,从搭建环境到开发,再到最终的构建打包,本项目源码GitHub地址:https://github.com/mazeyqian/go-run-wechat-demo前言Wails是一个跨平台桌面应用开发框架,他允许开发者利用Go的性能优势,并结合任何前端技术栈,如React、Vue或Svelte,来创建桌面应......
  • 深入探索WebKitGTK+:打造浏览器界面的核心利器
            导语:今天我要向大家介绍WebKitGTK+,这个强大的开源组件负责与操作系统交互,显示网页内容,并提供GUI界面、菜单、工具栏等组件。无论你是前端开发者还是UI设计师,这篇文章都将为你提供一个全面、实用的指南。让我们一起揭开WebKitGTK+的神秘面纱吧!       ......
  • 强制设置和恢复依赖属性值(类似WPF内置的Style.Trigger和Template.Trigger)
    WPF元素的依赖属性的值由众多规则决定,最高优先级的规则决定依赖属性的最终当前值。如本地值>继承值>默认值。可以临时忽略一切规则,强制为依赖属性指定一个值,相当于强行插入一个最高优先级规则,后续可以删除此强制值(最高优先级规则),将依赖属性的值恢复成原来的计算规则。这个......
  • WPF实现树形下拉列表框(TreeComboBox)
    前言树形下拉菜单是许多WPF应用程序中常见的用户界面元素,它能够以分层的方式展示数据,提供更好的用户体验。本文将深入探讨如何基于WPF创建一个可定制的树形下拉菜单控件,涵盖从原理到实际实现的关键步骤。一、需求分析    树形下拉菜单控件的核心是将ComboBox与TreeVi......
  • 如何实现仿微信界面[我的+首页聊天列表+长按菜单功能+添加菜单功能]
    如何实现仿微信界面[我的+首页聊天列表+长按菜单功能+添加菜单功能]一、简介如何实现仿微信界面[我的+首页聊天列表+长按菜单功能+添加菜单功能]采用uni-app实现,可以适用微信小程序、其他各种小程序以及APP、Web等多个平台具体实现步骤如下:下载开发者工具HbuilderX进入......
  • 小程序实现微信 【我的】界面
    小程序实现仿微信【我的】界面一、简介小程序实现仿微信【我的】界面采用uni-app实现,可以适用微信小程序、其他各种小程序以及APP、Web等多个平台具体实现步骤如下:下载开发者工具HbuilderX进入【Dcloud插件市场】搜索【小程序实现仿微信【我的】界面】,一键导入......
  • 【QT入门】 Qt代码创建布局综合运用:仿写腾讯会议登陆界面
    往期回顾:【QT入门】Qt代码创建布局之水平布局、竖直布局详解-CSDN博客【QT入门】Qt代码创建布局之栅格布局详解-CSDN博客【QT入门】Qt代码创建布局之分裂器布局详解-CSDN博客【QT入门】Qt代码创建布局综合运用:仿写腾讯会议登陆界面一、界面分析 主要用到水平布局......
  • WPF中Ribbon控件的使用
    WPF中Ribbon控件的使用这篇博客将分享如何在WPF程序中使用Ribbon控件。Ribbon可以很大的提高软件的便捷性。上面截图使Outlook2010的界面,在Home标签页中,将所属的Menu都平铺的布局,非常容易的可以找到想要的Menu。在Outlook2003时代,将Home下面的Menu都垂直的排列下来,操作的便捷程......