首页 > 代码库 > Silverlight 登陆界面
Silverlight 登陆界面
美术水平有限,不喜勿喷。
界面代码,效果如下图
<UserControl x:Class="ElecDemoTelerikSL.Login" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:my="clr-namespace:Drawsee.Sl.AppBase.UserManage.UI;assembly=Drawsee.Sl.AppBase" mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="1200"> <Grid x:Name="LayoutRoot" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"> <Grid.Background> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FF007CC3"/> <GradientStop Color="#FF93CAE2" Offset="1"/> </LinearGradientBrush> </Grid.Background> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock Text="登陆测试" FontSize="24" HorizontalAlignment="Center" Margin="0,0,0,20" /> <Grid Width="600" Height="300"> <Rectangle Fill="#50000000" RadiusX="10" RadiusY="10" Margin="10,10,-10,-15" /> <Image Source="images/elec_background.jpg" Height="300" HorizontalAlignment="Center" Name="imageBackground" Stretch="Fill" VerticalAlignment="Center" Width="600"> <Image.Clip> <RectangleGeometry RadiusX="12" RadiusY="12" Rect="0,0,600,300" /> </Image.Clip> </Image> <Border BorderBrush="#80000000" BorderThickness="1" CornerRadius="10" > </Border> <Grid Margin="358,124,29,42"> <Rectangle Stretch="Fill" Fill="#4FFFFFFF" RadiusX="20" RadiusY="20" /> <sdk:Label Content="登录名:" Height="24" HorizontalAlignment="Left" Name="lblLoginName" VerticalAlignment="Top" Width="60" Margin="11,20,0,0" /> <sdk:Label Content="密 码:" Height="24" HorizontalAlignment="Left" Name="lblLoginPwd" VerticalAlignment="Top" Width="60" Margin="11,58,0,0" /> <TextBox Height="24" HorizontalAlignment="Left" Name="txtLoginName" VerticalAlignment="Top" Width="120" Margin="77,17,0,0" /> <PasswordBox Height="24" HorizontalAlignment="Left" Margin="77,55,0,0" Name="txtLoginPwd" VerticalAlignment="Top" Width="120" /> <Button Content="登陆" Height="24" HorizontalAlignment="Left" Name="btnLogin" VerticalAlignment="Top" Width="75" Margin="22,95,0,0" Click="btnLogin_Click" /> <Button Content="取消" Height="24" HorizontalAlignment="Left" Name="btnCancel" VerticalAlignment="Top" Width="75" Margin="122,95,0,0" /> </Grid> </Grid> </StackPanel> </Grid> </UserControl>
后台代码
public partial class Login : UserControl { public Login() { InitializeComponent(); txtLoginName.Text = "admin"; } private void btnLogin_Click(object sender, RoutedEventArgs e) { string loginName =txtLoginName.Text.Trim(); string loginPwd =txtLoginPwd.Password.Trim(); if (loginName.Equals("admin") && loginName.Equals("admin")) this.Content = new MainPage(); //跳转到主页面 else MessageBox.Show("登陆失败!", "提示", MessageBoxButton.OKCancel); } }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。