欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

WPF做的登录页面

程序员文章站 2022-04-01 10:29:54
我们用WPF做了一个简单的登录页面:

我们用WPF做了一个简单的登录页面:

<Window x:Class="Catering.View.LoginPage.Login"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        WindowStartupLocation="CenterScreen"

        xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"

        Title="登录" Height="500" Width="350"

        ResizeMode="NoResize"

        WindowStyle="None"

        Icon="F:\项目计划书\新建文件夹\Catering\Catering\images\001.ico"

        MouseLeftButtonDown="MoveWindow_MouseLeftButtonDown"

        FontFamily="Segoe UI Emoji">

    <Grid>

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="58*"/>

            <ColumnDefinition Width="59*"/>

        </Grid.ColumnDefinitions>



        <Rectangle Height="280" VerticalAlignment="Top" Grid.ColumnSpan="2" Margin="0,0,0.4,0">

            <Rectangle.Fill>

                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

                    <GradientStop Color="#FF2281D1"/>

                    <GradientStop Color="SkyBlue" Offset="1"/>

                    <GradientStop Color="SkyBlue" Offset="0.546"/>

                </LinearGradientBrush>

            </Rectangle.Fill>

        </Rectangle>



        <Rectangle Width="280" Height="240" VerticalAlignment="Bottom" Margin="35,0,35.4,80" RadiusY="10" RadiusX="10" Fill="White" Grid.ColumnSpan="2">

            <Rectangle.Effect>

                <DropShadowEffect BlurRadius="15" Direction="0" RenderingBias="Quality" ShadowDepth="1" Color="#FFBBBBBB"/>

            </Rectangle.Effect>

        </Rectangle>

        <Grid VerticalAlignment="Bottom" Margin="35,0,35.4,80" Height="240" Grid.ColumnSpan="2">

            <Label Content="欢迎登录订餐系统" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="5" Foreground="Gray" FontSize="18"/>

            <StackPanel VerticalAlignment="Center" Margin="15">

                <TextBox Margin="0,10" x:Name="ZhangHao" materialDesign:HintAssist.Hint="账号" Style="{StaticResource MaterialDesignFloatingHintTextBox}" FontFamily="Champagne &amp; Limousines" FontSize="18" VerticalContentAlignment="Center"/>

                <PasswordBox Margin="0,10" x:Name="MiMa" materialDesign:HintAssist.Hint="密码" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" FontFamily="Champagne &amp; Limousines" FontSize="18"/>

            </StackPanel>

        </Grid>

        <Button Width="150" Name="DengLu" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="100,0,100.4,65" Content="登录" Grid.ColumnSpan="2" Click="DengLu_Click"/>

        <!--<TextBlock Text="忘记密码?" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="30" Foreground="Gray" Cursor="Hand"/>-->

        <Button Content="忘了密码" HorizontalAlignment="Center" Style="{StaticResource MaterialDesignFlatButton}"  Margin="137,440,125.4,28" Foreground="Gray" Cursor="Hand" Grid.ColumnSpan="2"/>

        <Button Content="注册" Name="ZhuCe" HorizontalAlignment="Left" Style="{StaticResource MaterialDesignFlatButton}"  Margin="35,440,0,28" Foreground="Gray" Cursor="Hand" Click="ZhuCe_Click"/>

        <Button Content="后台" Name="HouTai" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}"  Margin="0,440,35.4,28" Foreground="Gray" Cursor="Hand" Grid.Column="1" Click="HouTai_Click"/>

        <Button HorizontalAlignment="Right" VerticalAlignment="Top" Background="{x:Null}" BorderBrush="{x:Null}" Click="Close_Click" Grid.Column="1" Margin="0,0,0.4,0">

            <materialDesign:PackIcon Kind="Close"/>

        </Button>

        <Image  Source="F:\项目计划书\新建文件夹\Catering\Catering\images\png-0762.png" Width="100" Height="100" VerticalAlignment="Top" Margin="125,30,125.4,0" Grid.ColumnSpan="2"/>

    </Grid>

</Window>

看下面的结果截图:

WPF做的登录页面

本文地址:https://blog.csdn.net/qq_39827390/article/details/107898468

相关标签: WPF