C# 类似QQ的窗体抖动效果
/// <summary>
/// 抖动窗体
/// </summary>
/// <param name="frm">窗体</param>
public void JitterForm(Form frm)
{
Point pOld = frm.Location;//原来的位置
int radius = 3;//半径
for (int n = 0; n < 3; n++) //旋转圈数
{
//右半圆逆时针
for (int i = -radius; i <= radius; i++)
{
int x = Convert.ToInt32(Math.Sqrt(radius * radius - i * i));
int y = -i;
frm.Location = new Point(pOld.X + x, pOld.Y + y);
System.Threading.Thread.Sleep(10);
}
//左半圆逆时针
for (int j = radius; j >= -radius; j--)
{
int x = -Convert.ToInt32(Math.Sqrt(radius * radius - j * j));
int y = -j;
frm.Location = new Point(pOld.X + x, pOld.Y + y);
System.Threading.Thread.Sleep(10);
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载