【2019-10-13】 03-登陆页面完成--研发部内部分享

2019-10-17  本文已影响0人  为体验更多

任务:在自己项目中还原下面的操作,并且了解业务逻辑(界面不是主要,有大概B数就行)。

一.登陆页面效果(可以自己创新):

03-01.png

二.项目结构:

03-02.png

三.登陆所用图片:

03-03.png 微信截图_20191017113925.png

四.xaml代码:

<Window x:Class="LoginWindows.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:LoginWindows"

mc:Ignorable="d"

Title="ManyChat"

Height="250"

Width="350"

WindowStyle="None"

WindowStartupLocation="CenterScreen"

ResizeMode="NoResize"

MouseLeftButtonDown="Window_MouseLeftButtonDown">

<Window.Background>

<ImageBrush ImageSource="Images/QQ背景图片.png"></ImageBrush>

</Window.Background>

<DockPanel LastChildFill="True">

<DockPanel Background="Transparent" DockPanel.Dock="Top" Height="25">

<TextBlock Text="登陆" Foreground="White" FontSize="12" Padding="5" DockPanel.Dock="Left"/>

<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Background="Transparent" HorizontalAlignment="Right">

<Button Content=" — " Foreground="White" Background="Transparent" BorderThickness="0" Name="Btn_min" Click="Btn_min_Click"></Button>

<Button Content=" X " Foreground="White" Background="Transparent" BorderThickness="0" Name="Btn_close" Click="Btn_close_Click" ></Button>

</StackPanel>

</DockPanel>

<DockPanel Background="Transparent" DockPanel.Dock="Bottom" >

<StackPanel Orientation="Horizontal" Background="Transparent" DockPanel.Dock="Bottom" HorizontalAlignment="Right" Width="191">

<Button Content=" 登陆 " Foreground="White" Margin="0,10,10,10" Padding="5" Background="Transparent" BorderThickness="0"

Name="Btn_login" Click="Btn_login_Click">

</Button>

<Button Content=" 取消 " Foreground="White" Margin="0,10,10,10" Padding="5" Background="Transparent" BorderThickness="0" Name="Btn_cancer" Click="Btn_cancer_Click" >

</Button>

<Button Content=" 注册? " Foreground="White" Margin="0,10,10,10" Padding="5" Background="Transparent" BorderThickness="0" Name="Btn_register" Click="Btn_register_Click" >

</Button>

</StackPanel>

</DockPanel>

<DockPanel Background="Transparent" DockPanel.Dock="Left" >

<Image DockPanel.Dock="Left" Source="Images/AlarmCenterIcon.ico" Width="50" Height="50" Margin="50,10,10,10"></Image>

<Rectangle Width="50" DockPanel.Dock="Right"/>

<Grid Margin="0,50,0,53" >

<Grid.ColumnDefinitions>

<ColumnDefinition Width="Auto"/>

<ColumnDefinition Width="1*"/>

</Grid.ColumnDefinitions>

<Grid.RowDefinitions>

<RowDefinition Height="1*"/>

<RowDefinition Height="1*"/>

</Grid.RowDefinitions>

<TextBlock Grid.Row="0" Grid.Column="0" TextAlignment="Right" Foreground="White" Padding="0,2,0,0" Text="QQ号:" Name="UserName" Height="22"/>

<TextBlock Grid.Row="1" Grid.Column="0" TextAlignment="Right" Foreground="White" Padding="0,2,0,0" Text="密码:" Name="pass" Height="22"/>

<TextBox VerticalContentAlignment="Center" Name="TxtBoxName" Grid.Row="0" Grid.Column="1" Text="" Height="22" Background="#FFB6CEEC" />

<PasswordBox VerticalContentAlignment="Center" Name="pass1" Background="White" Grid.Row="1" Grid.Column="1" Height="22"/>

</Grid>

</DockPanel>

</DockPanel>

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

namespace LoginWindows

{

/// <summary>

/// MainWindow.xaml 的交互逻辑

/// </summary>

public partial class MainWindow : Window

{

public MainWindow()

{

InitializeComponent();

}

/// <summary>

/// 窗体鼠标左键事件,设置为拖动

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)

{

this.DragMove();

}

/// <summary>

/// 窗体最小化

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void Btn_min_Click(object sender, RoutedEventArgs e)

{

this.WindowState = WindowState.Minimized;

}

/// <summary>

/// 窗体关闭

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void Btn_close_Click(object sender, RoutedEventArgs e)

{

this.Close();

}

/// <summary>

/// 登陆操作

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void Btn_login_Click(object sender, RoutedEventArgs e)

{

}

/// <summary>

/// 取消操作

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void Btn_cancer_Click(object sender, RoutedEventArgs e)

{

}

/// <summary>

/// 注册操作

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void Btn_register_Click(object sender, RoutedEventArgs e)

{

this.Hide();

RegisterWindow regis = new RegisterWindow();

regis.ShowDialog();

this.Close();

}

}

}

上一篇下一篇

猜你喜欢

热点阅读