基本信息
源码名称:WPF翻转效果示例(仿QQ登录界面)
源码大小:0.02M
文件格式:.zip
开发语言:C#
更新时间:2017-06-10
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍

    仿QQ登录界面


<Window x:Class="翻转.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="420" Width="650"
        xmlns:local="clr-namespace:翻转"
        WindowStyle="None"
        ResizeMode="NoResize"
        AllowsTransparency="True"
        Background="Transparent"
        WindowStartupLocation="CenterScreen">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        <Viewport3D Grid.Row="0" Margin="3">
            <Viewport3D.Camera>
                <PerspectiveCamera Position="0 0 800" LookDirection="0 0 -1" NearPlaneDistance="100"/>
            </Viewport3D.Camera>
            <Viewport3D.Children>
                <ContainerUIElement3D>
                    <Viewport2DVisual3D>
                        <Viewport2DVisual3D.Geometry>
                            <MeshGeometry3D Positions="-200 150 0  -200 -150 0  200 -150 0  200 150 0" TriangleIndices="0 1 2  0 2 3" TextureCoordinates="0 0  0 1  1 1  1 0"/>
                        </Viewport2DVisual3D.Geometry>
                        <Viewport2DVisual3D.Material>
                            <DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True"/>
                        </Viewport2DVisual3D.Material>
                        <Viewport2DVisual3D.Visual>
                            <local:UcSample1 Width="400" Height="300"/>
                        </Viewport2DVisual3D.Visual>
                    </Viewport2DVisual3D>
                    <Viewport2DVisual3D>
                        <Viewport2DVisual3D.Geometry>
                            <MeshGeometry3D Positions="200 150 0  200 -150 0  -200 -150 0  -200 150 0" TriangleIndices="0 1 2  0 2 3" TextureCoordinates="0 0  0 1  1 1  1 0"/>
                        </Viewport2DVisual3D.Geometry>
                        <Viewport2DVisual3D.Material>
                            <DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True"/>
                        </Viewport2DVisual3D.Material>
                        <Viewport2DVisual3D.Visual>
                            <local:UcSample2 Width="400" Height="300"/>
                        </Viewport2DVisual3D.Visual>
                    </Viewport2DVisual3D>
                    <!-- 三维变换 -->
                    <ContainerUIElement3D.Transform>
                        <RotateTransform3D CenterX="0.5" CenterY="0.5" CenterZ="0.5">
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D x:Name="axr" Angle="0" Axis="0 1 0"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                    </ContainerUIElement3D.Transform>
                </ContainerUIElement3D>
                <ModelVisual3D>
                    <ModelVisual3D.Content>
                        <DirectionalLight Color="Transparent"/>
                    </ModelVisual3D.Content>
                </ModelVisual3D>
            </Viewport3D.Children>
        </Viewport3D>
    </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.Windows.Media.Media3D;
using System.Windows.Media.Animation;

namespace 翻转
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public static MainWindow my;
        public bool[] cg;
        public MainWindow()
        {
            InitializeComponent();
            MainWindow.my = this;
        }
        public MainWindow(ref bool[] cg)
        {
            InitializeComponent();
            MainWindow.my = this;
            this.cg = cg;
        }
        public void OnClick(int s)
        {
            switch (s)
            {
                case 0:
                    this.Close();
                    break;
                case 1:
                    DoubleAnimation da = new DoubleAnimation();
                    da.Duration = new Duration(TimeSpan.FromSeconds(1));
                    da.To = 0d;
                    this.axr.BeginAnimation(AxisAngleRotation3D.AngleProperty, da);
                    break;
                case 2:
                    da = new DoubleAnimation();
                    da.Duration = new Duration(TimeSpan.FromSeconds(1));
                    da.To = 180d;
                    this.axr.BeginAnimation(AxisAngleRotation3D.AngleProperty, da);
                    break;
            }
        }
    }
}

 

 

<UserControl x:Class="翻转.UcSample1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="500">
    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="背景.png"/>
        </Grid.Background>
        <Grid Margin="20">
            <Grid.RowDefinitions>
                <RowDefinition Height="80"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <TextBlock Text="用户登录" FontSize="42" FontFamily="华文行楷" VerticalAlignment="Center" HorizontalAlignment="Center"/>
            <Grid Margin="5" Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>
                <TextBlock Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" Text="用户名:" FontSize="24" VerticalAlignment="Center"/>
                <TextBox Name="tex1" Grid.Column="1" Grid.Row="0" Margin="3,4,16,4" FontSize="24"/>
                <TextBlock Grid.Column="0" Grid.Row="1" Text="密码:" FontSize="24" HorizontalAlignment="Right" VerticalAlignment="Center"/>
                <PasswordBox Name="tex2" Grid.Column="1" Grid.Row="1" Margin="3,4,16,4" FontSize="24"/>
            </Grid>
            <Grid Grid.Row="2" MouseDown="Grid_MouseDown_2" HorizontalAlignment="Center" Margin="0,15,0,15" Width="180" Height="36">
                <Grid.Background>
                    <ImageBrush ImageSource="登录.png"/>
                </Grid.Background>
            </Grid>
        </Grid>
        <Grid Name="mygrid1" HorizontalAlignment="Right" Margin="0,4,4,0" Height="16" VerticalAlignment="Top" Width="16" MouseEnter="Grid_MouseEnter" MouseLeave="Grid_MouseLeave" Background="#07BDCFFF" MouseDown="Grid_MouseDown">
            <!--<Polygon Name="p1"   Points="0,0,10,18,50,18,60,0"  Fill="White" StrokeThickness="1" HorizontalAlignment="Left" VerticalAlignment="Top" StrokeLineJoin="Miter" />-->
            <Line Name="line1" X1="1" Y1="1" X2="15" Y2="15" Stroke="Black"  StrokeThickness="2" />
            <Line Name="line2"  X1="15" Y1="1" X2="1" Y2="15" Stroke="Black"  StrokeThickness="2" />
            <!--<Line X1="50" Y1="18" X2="60" Y2="0" Stroke="Black"  StrokeThickness="1" />-->
        </Grid>

        <Grid Name="mygrid2" HorizontalAlignment="Right" Margin="0,2,26,0" Height="20" VerticalAlignment="Top" Width="20" MouseEnter="Grid_MouseEnter_1" MouseDown="Grid_MouseDown_1">
            <Grid.Background>
                <ImageBrush ImageSource="设置.png"/>
            </Grid.Background>
        </Grid>

        <Grid  HorizontalAlignment="Left" Margin="2,2,26,0" Height="20" VerticalAlignment="Top" Width="20" >
            <Grid.Background>
                <ImageBrush ImageSource="登录图标(1).png"/>
            </Grid.Background>
        </Grid>

    </Grid>
</UserControl>

 

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 翻转
{
    /// <summary>
    /// UcSample1.xaml 的交互逻辑
    /// </summary>
    public partial class UcSample1 : UserControl
    {
        private Brush mygrid1_Background;
        public UcSample1()
        {
            InitializeComponent();
            this.mygrid1_Background = this.mygrid1.Background;
        }
        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
        {
            MainWindow.my.OnClick(0);
        }
        private void Grid_MouseEnter(object sender, MouseEventArgs e)
        {
            this.line1.Stroke = Brushes.Red;
            this.line2.Stroke = Brushes.Red;
            this.mygrid1.Background = Brushes.White;
        }

        private void Grid_MouseDown_1(object sender, MouseButtonEventArgs e)
        {
            MainWindow.my.OnClick(2);
        }

        private void Grid_MouseEnter_1(object sender, MouseEventArgs e)
        {

        }

        private void Grid_MouseLeave(object sender, MouseEventArgs e)
        {
            this.line1.Stroke = Brushes.Black;
            this.line2.Stroke = Brushes.Black;
            this.mygrid1.Background = mygrid1_Background;
        }

        private void Grid_MouseDown_2(object sender, MouseButtonEventArgs e)
        {
            if (tex1.Text == "1" && tex2.Password == "111111")
            {
                MainWindow.my.cg[0] = true;
                MainWindow.my.OnClick(0);
            }
            else
            {
                MessageBox.Show("用户名=1;密码=111111");
            }
        }
    }
}

<UserControl x:Class="翻转.UcSample2"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="500">
    <Grid>
        <Grid.Background>
            <LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
                <GradientStop Color="#FF7367E6" Offset="0"/>
                <GradientStop Color="#FF789AF3" Offset="1"/>
                <GradientStop Color="#FFD5CCF7" Offset="0.558"/>
            </LinearGradientBrush>
        </Grid.Background>
        <Canvas Margin="20" SnapsToDevicePixels="True">
            <TextBlock Text="连接方式:" FontSize="22"/>
            <StackPanel Orientation="Vertical" Canvas.Top="36">
                <RadioButton GroupName="g" Content="TCP" FontSize="20"/>
                <RadioButton GroupName="g" Content="UDP" FontSize="20"/>
            </StackPanel>
            <GroupBox Canvas.Top="120" Header="设置代理">
                <Grid Margin="12">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition Width="auto"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Column="0" Grid.Row="0" Text="IP地址:" VerticalAlignment="Center"/>
                    <TextBox Grid.Row="0" Grid.Column="1" Width="150" Margin="5"/>
                    <TextBlock Grid.Column="0" Grid.Row="1" Text="端口:" VerticalAlignment="Center"/>
                    <TextBox Grid.Column="1" Grid.Row="1" Width="150" Margin="5"/>
                </Grid>
            </GroupBox>
        </Canvas>
        <Grid Name="mygrid1" HorizontalAlignment="Right" Margin="0,4,4,0" Height="16" VerticalAlignment="Top" Width="16" MouseEnter="Grid_MouseEnter" MouseLeave="Grid_MouseLeave" Background="#07BDCFFF" MouseDown="Grid_MouseDown">
            <!--<Polygon Name="p1"   Points="0,0,10,18,50,18,60,0"  Fill="White" StrokeThickness="1" HorizontalAlignment="Left" VerticalAlignment="Top" StrokeLineJoin="Miter" />-->
            <Line Name="line1" X1="1" Y1="1" X2="15" Y2="15" Stroke="Black"  StrokeThickness="2" />
            <Line Name="line2"  X1="15" Y1="1" X2="1" Y2="15" Stroke="Black"  StrokeThickness="2" />
            <!--<Line X1="50" Y1="18" X2="60" Y2="0" Stroke="Black"  StrokeThickness="1" />-->
        </Grid>
    </Grid>
</UserControl>

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 翻转
{
    /// <summary>
    /// UcSample2.xaml 的交互逻辑
    /// </summary>
    public partial class UcSample2 : UserControl
    {
        private Brush mygrid1_Background;
        public UcSample2()
        {
            InitializeComponent();
            this. mygrid1_Background = this.mygrid1.Background;
        }
        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
        {
            MainWindow.my.OnClick(1);
        }

        private void Grid_MouseEnter(object sender, MouseEventArgs e)
        {
            this.line1.Stroke = Brushes.Red;
            this.line2.Stroke = Brushes.Red;
            this.mygrid1.Background = Brushes.White;
        }

        private void Grid_MouseLeave(object sender, MouseEventArgs e)
        {
            this.line1.Stroke = Brushes.Black;
            this.line2.Stroke = Brushes.Black;
            this.mygrid1.Background = mygrid1_Background;
        }
    }
}