zoukankan      html  css  js  c++  java
  • 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);

    }

    }

    }

    }

    }

     

  • 相关阅读:
    最常用的排序——快速排序
    堆排序 Heap Sort
    经典排序算法
    Android studio界面相关设置
    对了解矩阵、线性变换的本质有太大帮助
    [转]grep 在文本中查找内容
    [转] PHP在不同页面之间传值的三种常见方式
    快速幂取余 [转]
    Avril Lavigne : Everybody Hurts (Ver3)
    MySQL 初始化root 密码
  • 原文地址:https://www.cnblogs.com/benbenfishfish/p/3738735.html
Copyright © 2011-2022 走看看