zoukankan      html  css  js  c++  java
  • WPF中做出一个QQ登陆界面

    Xaml:

    <Window x:Class="ChatSoftware.MainWindow"
            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:local="clr-namespace:ChatSoftware"
            mc:Ignorable="d"
            Title="MainWindow" Height="603.659" Width="994.776">
        <Window.Resources>
            <local:Number x:Key="Key_Number"/>
            <local:Fruits x:Key="Key_Fruits"/>
        </Window.Resources>
        <Grid HorizontalAlignment="Left" Height="560" Margin="10,10,0,0" VerticalAlignment="Top" Width="975">
            <Grid.Background>
                <ImageBrush ImageSource="Resources/timg (3).jpg"/>
            </Grid.Background>
            <Grid.RowDefinitions>
                <RowDefinition Height="400"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <StackPanel HorizontalAlignment="Left" Height="204" Margin="192,119,0,0" VerticalAlignment="Top" Width="601" Grid.Column="200">
                <Grid Height="202" Background="Transparent" Margin="0,0,-100.2,0">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition Height="50"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="200"/>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Image HorizontalAlignment="Left" Height="135" Margin="36,36,0,0" Grid.RowSpan="3" VerticalAlignment="Top" Width="137" Source="Resources/2.jpg" RenderTransformOrigin="0.513,0.666" Stretch="Fill"/>
                    <ComboBox Background="White" DataContext="{StaticResource Key_Number}" ItemsSource="{Binding Items, Source={StaticResource Key_Number}}" SelectedIndex="0" Grid.Column="1" HorizontalAlignment="Left" Margin="34,36,0,0" VerticalAlignment="Top" Width="301" Height="40" Grid.ColumnSpan="2" BorderBrush="#FFC0EBCB" IsEditable="True" FontSize="18"/>
                    <CheckBox Content="记住密码" Grid.Column="1" HorizontalAlignment="Left" Margin="34,10,0,0" Grid.Row="2" VerticalAlignment="Top" Height="30" Width="115" FontSize="16" FontStyle="Oblique" Foreground="#FFD7C73B"/>
                    <CheckBox Content="自动登陆" Grid.Column="2" HorizontalAlignment="Left" Margin="20.8,9.8,0,0" Grid.Row="2" VerticalAlignment="Top" Height="30" RenderTransformOrigin="0.438,1.063" FontSize="16" Foreground="#FF9174BF"/>
                    <PasswordBox Grid.Column="1" MaxLength="15" HorizontalAlignment="Left" Margin="34,28,0,0" Grid.Row="1" VerticalAlignment="Top" Height="38" Grid.ColumnSpan="2" Width="301" FontSize="18"/>
                    <TextBlock Grid.Column="2" HorizontalAlignment="Right" Margin="0,36,9.8,0" TextWrapping="Wrap" Text="" Width="122" Height="40" VerticalAlignment="Top" FontSize="18">
                        <Hyperlink NavigateUri="http://www.baidu.com" Click="Hyperlink_Click"
                           >注册账号</Hyperlink>
                    </TextBlock>
    
                </Grid>
            </StackPanel>
            <Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="100" Margin="360,10,0,0" Grid.Row="1" VerticalAlignment="Top" Width="293" CornerRadius="20" Background="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}">
                <Button Background="Transparent" Content="登     陆" FontSize="36" Foreground="#FF264515" RenderTransformOrigin="0.477,0.058" Margin="-0.8,-0.8,-1,0" BorderBrush="Transparent"/>
            </Border>
            <TextBlock HorizontalAlignment="Left" Margin="764,219,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="36" Width="115" Foreground="#FFB8D60D" FontSize="18">
                <Hyperlink NavigateUri="http://www.baidu.com" Click="Hyperlink_Click"
                           >找回密码</Hyperlink>
            </TextBlock>
        </Grid>
    </Window>

    后台:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using System.Diagnostics;
    
    namespace ChatSoftware
    {
        /// <summary>
        /// MainWindow.xaml 的交互逻辑
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
    
            }
    
            private void Hyperlink_Click(object sender, RoutedEventArgs e)
            {
                Hyperlink link = sender as Hyperlink;
    
                Process.Start(new ProcessStartInfo(link.NavigateUri.AbsoluteUri));
            }
        }
    
    }

    Class(Number):

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace ChatSoftware
    {
        public class Number
        {
            public Number()
            {
                Items = new List<string>
                {
                    "1308531510",
                    "2569875222",
                    "5648999998",
                    "2415645616",
                };
            }
    
            public List<string> Items { get; set; }
        }
    }

    效果图:

  • 相关阅读:
    深度学习原理与框架-神经网络-线性回归与神经网络的效果对比 1.np.c_[将数据进行合并] 2.np.linspace(将数据拆成n等分) 3.np.meshgrid(将一维数据表示为二维的维度) 4.plt.contourf(画出等高线图,画算法边界)
    深度学习原理与框架-神经网络-cifar10分类(代码) 1.np.concatenate(进行数据串接) 2.np.hstack(将数据横着排列) 3.hasattr(判断.py文件的函数是否存在) 4.reshape(维度重构) 5.tanspose(维度位置变化) 6.pickle.load(f文件读入) 7.np.argmax(获得最大值索引) 8.np.maximum(阈值比较)
    深度学习原理与框架-神经网络架构 1.神经网络构架 2.激活函数(sigmoid和relu) 3.图片预处理(减去均值和除标准差) 4.dropout(防止过拟合操作)
    Linux执行命令unable to create new native thread问题
    ElasticSearch的备份迁移方案
    Mycat高可用集群搭建
    Mogodb集群搭建
    SparkStreaming和Drools结合的HelloWord版
    Drools的HelloWord例子
    Drools环境搭建
  • 原文地址:https://www.cnblogs.com/Leozi/p/10816985.html
Copyright © 2011-2022 走看看