• WPF 实现QQ抖动


    //wpf中实现类似于qq的抖动窗效果

    //前段页面

    <Window x:Class="WpfApplication4.MainWindow"

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

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

    Title="MainWindow" Height="350" Width="525">

    <Grid>

    <Button Content="退" Height="23" HorizontalAlignment="Left" Margin="248,177,0,0" Name="button1" VerticalAlignment="Top" Width="75" Background="#FF185886" Foreground="White" />

    <Button Foreground="White" Content="" Height="23" HorizontalAlignment="Left" Margin="156,177,0,0" Name="button2" VerticalAlignment="Top" Width="75" BorderBrush="#FFEFD9D9" Click="button2_Click">

    <Button.Background>

    <RadialGradientBrush>

    <GradientStop Color="Black" Offset="0" /><!--这里实现过渡-->

    <GradientStop Color="#FF2D73BA" Offset="1" />

    </RadialGradientBrush>

    </Button.Background>

    </Button>

    <TextBlock Height="23" HorizontalAlignment="Left" Margin="101,110,0,0" Name="textBlock1" Text="用户ID:" VerticalAlignment="Top" />

    <TextBlock Height="23" HorizontalAlignment="Left" Margin="90,139,0,0" Name="textBlock2" Text="用户密码:" VerticalAlignment="Top" />

    <TextBox Height="23" HorizontalAlignment="Left" Margin="156,107,0,0" Name="textBox1" VerticalAlignment="Top" Width="167" />

    <PasswordBox Height="23" HorizontalAlignment="Left" Margin="156,139,0,0" Name="passwordBox1" VerticalAlignment="Top" Width="167" />

    </Grid>

    </Window>

    //后台

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    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 WpfApplication4

    {

    ///<summary>

    /// MainWindow.xaml 的交互逻辑

    ///</summary>

    public partial class MainWindow : Window

    {

    public MainWindow()

    {

    InitializeComponent();

    }

    private void button2_Click(object sender, RoutedEventArgs e)

    {

    int i, j, k; //定义三个变量

    for (i = 1; i <= 3; i++) //循环次数

    {

    for (j = 1; j <= 10; j++)

    {

    this.Top += 5;

    this.Left += 5;

    System.Threading.Thread.Sleep(5); //当前线程指定挂起的时间

    }

    for (k = 1; k <= 10; k++)

    {

    this.Top -= 5;

    this.Left -= 5;

    System.Threading.Thread.Sleep(5);

    }

    }

    }

    }

    }

     

  • 相关阅读:
    Linux命令记录-Tomcat(七)
    Linux命令记录-PostgreSql(六)
    Linux命令记录-Mysql(五)
    Linux Crontab实现定时任务
    Linux命令记录-Java环境(四)
    Linux命令记录-防火墙(三)
    Linux命令记录-服务相关(二)
    Linux命令记录-环境准备(一)
    Linux 系统安装,磁盘分区要点
    java之Collection类
  • 原文地址:https://www.cnblogs.com/benbenfishfish/p/3738735.html
Copyright © 2020-2023  润新知