首页 > Windows开发 > 详细

[WPF]学习笔记一---登陆窗体

时间:2015-11-05 07:37:55      阅读:341      评论:0      收藏:0      [点我收藏+]

之前自己写了个Winform的小管理程序,总是感觉不好,这次借着学WPF把这个软件重新做一下。计划用EF框架操作数据库,在调用的时候,db引不过来,。。

这个暂时搁置一下。先把UI做了下吧。

初学WPF,写了一个XAML的登陆窗体。感觉比WinForm用着爽多了。不拖控件的感觉很爽。

下面是登陆窗体

XMAL

技术分享
 1 <Window x:Class="HpuShoots.Login"
 2       
 3         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 4         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 5         Title="登陆" Height="350" Width="525" Icon="shoots.ico" Foreground="White">
 6     <Window.Background>
 7         <ImageBrush ImageSource="img/login_bg.jpg"/>
 8     </Window.Background>
 9     <Grid>
10         <Grid Opacity="0.6">
11             <Grid.Background>
12                 <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlLightLightColorKey}}"/>
13             </Grid.Background>
14             <Grid.RowDefinitions>
15                 <RowDefinition />
16                 <RowDefinition />
17                 <RowDefinition />
18                 <RowDefinition />
19                 <RowDefinition />
20             </Grid.RowDefinitions>
21             <Grid.ColumnDefinitions>
22                 <ColumnDefinition Width="5*" />
23                 <ColumnDefinition Width="18*"/>
24                 <ColumnDefinition Width="29*" />
25             </Grid.ColumnDefinitions>
26             <Label Name="title" Content="HPU活动管理系统" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="30" Height="48" Margin="69.658,8,120,8.5" Width="280" />
27             <Label Name="user" Content="账户:" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" Margin="46.658,8.5,57.5,18" Height="38" Width="76" Background="White"  />
28             <Label Name="pwd" Content="密码:" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" Margin="46.658,8,57.5,18.5" Height="38" Width="76" Background="White" />
29             <TextBox Name="tbuser" Grid.Row="1"  Grid.Column="1" Margin="179.658,15.5,30,15" Grid.ColumnSpan="2"/>
30             <PasswordBox Name="pwdbox" Grid.Row="2"  Grid.Column="1" Margin="179.658,15,30,15.5" Grid.ColumnSpan="2"/>
31             <CheckBox  Name="rememberme" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Content="记住我?" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" Margin="147,19,186,19" Width="134"  />
32             <Button Name="btnlogin" Content="登陆" FontSize="22" Grid.Row="4" Grid.Column="1" Margin="29.658,10,0.5,10.5" ></Button>
33             <Button Name="btnexit" Content="取消" FontSize="22" Grid.Row="4" Grid.Column="2" Margin="77.5,10,62,10.5" ></Button>
34         </Grid>
35 
36     </Grid>
37 </Window>
View Code

实现效果

技术分享

 

[WPF]学习笔记一---登陆窗体

原文:http://www.cnblogs.com/yihy/p/4938105.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!