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>
View Code

后台代码

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);
        }
    }
View Code

 

Silverlight 登陆界面,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。