码迷,mamicode.com
首页 > 其他好文 > 详细

WPF 实现QQ抖动

时间:2014-05-22 02:20:32      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   c   tar   ext   

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

}

}

}

}

}

 

 

 

 bubuko.com,布布扣

 

 

 

 

 

 

WPF 实现QQ抖动,布布扣,bubuko.com

WPF 实现QQ抖动

标签:style   blog   class   c   tar   ext   

原文地址:http://www.cnblogs.com/benbenfishfish/p/3738735.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!