WPF 实现QQ抖动_.NET_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > .NET > WPF 实现QQ抖动

WPF 实现QQ抖动

 2014/5/20 15:09:49  笨笨鱼~  博客园  我要评论(0)
  • 摘要://wpf中实现类似于qq的抖动窗效果//前段页面<Windowx: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>
  • 标签:实现 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);

}

}

}

}

}

 

 

 

 

 

 

 

 

 

 

发表评论
用户名: 匿名