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; }
        }
    }

    效果图:

  • 相关阅读:
    Android应用程序注冊广播接收器(registerReceiver)的过程分析
    智能生活 “视”不可挡——首届TCL杯HTML5智能电视开发大赛等你来挑战
    点滴的积累---J2SE学习小结
    公开课
    iOS学习之 plist文件的读写
    【STL】关联容器 — hash_set
    《Pro Android Graphics》读书笔记之第三节
    第一章. ActionScript 语言基础
    JAVA数组的定义及用法
    MS-SQLSERVER中的MSDTC不可用解决方法
  • 原文地址:https://www.cnblogs.com/Leozi/p/10816985.html
Copyright © 2011-2022 走看看