C# 三种实现抖屏的方式

 1          //int a = -2;
 2             //this.BringToFront();
 3             //for (int i = 0; i < 20; i++)
 4             //{
 5             //    a = -a;
 6             //    this.Location = new Point(this.Location.X + 6 * a, this.Location.Y + 8 * a);
 7 
 8             //    Thread.Sleep(100);
 9 
10             //}
11             //2.
12             //int X = this.Top; int Y = this.Left;
13 
14             //for (int i = 0; i < 100; i++)
15             //{
16 
17             //    this.Top = this.Top + 10;
18 
19             //    this.Left = this.Left + 10;
20 
21             //    this.Top = this.Top - 10;
22 
23             //    this.Left = this.Left - 10;
24 
25             //}
26 
27             ////回到原来的位置
28 
29             //this.Top = X;
30             //this.Left = Y;
31 
32             //3.
33             Point pOld = this.Location;//原来的位置 
34             int radius = 3;//半径 
35             for (int n = 0; n < 3; n++) //旋转圈数 
36             {
37                 //右半圆逆时针 
38                 for (int i = -radius; i <= radius; i++)
39                 {
40                     int x = Convert.ToInt32(Math.Sqrt(radius * radius - i * i));
41 
42                     int y = -i;
43 
44                     this.Location = new Point(pOld.X + x, pOld.Y + y);
45 
46                     System.Threading.Thread.Sleep(10);
47 
48 
49                 }
50 
51                 //左半圆逆时针
52                 for (int j = radius; j >= -radius; j--)
53                 {
54                     int x = -Convert.ToInt32(Math.Sqrt(radius * radius - j * j));
55                     int y = -j;
56                     this.Location = new Point(pOld.X + x, pOld.Y + y);
57                     System.Threading.Thread.Sleep(10);
58                 }
59             }
60 
61             this.Location = pOld;

转载于:https://www.cnblogs.com/gaobing/p/3848884.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值