C # Three ways to achieve screen shake

Source: Internet
Author: User
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 /// return to the original position 28 29 // This. top = x; 30 // This. left = y; 31 32 // 3.33 point pold = This. location; // original position 34 int radius = 3; // radius 35 for (INT n = 0; n <3; n ++) // Number of rotated circles 36 {37 // the right half circle counter-clockwise 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 // left semi-circle counter-clockwise 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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.