This article shares the specific code for C# to implement simple window jitter for your reference. The specific content is as follows
Attribute assignment:
1. Check the attribute type. If it is the 15 predefined attribute types in C#, directly assign the value.
(1) Check the attribute type: hover the mouse over the attribute word;
(2) Predefined attribute types in C#
2. Exclude the first type, try to knock the space after the symbol. If there is a smart prompt, just hit the decimal point. Select a suitable option to end the semicolon.
3. When encountering a special type Color, use the attribute type word dot after the equal sign and select a semicolon to end.
Simple window jitter case
Project Analysis
1. First add the window loading event. When the page is loaded, set the size and initial position of the window. Add buttons to the window in the toolbox of the view; and set the attribute value of the text attribute of the button object.
2. Set a click event for the button object;
3. Change the position of the window (set the thread);
4. Set the for loop and execute it multiple times when clicking;
5. Add random colors (background)
using System; using ; using ; using ; using ; using ; using ; using ; using ; //All are namespacesusing ; namespace _02Window shaking { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { = ; //Set the window size = 300; = 300; //The window first knows the location = 300; = 300; //Button button set text to "button" = "Button"; = 80; = 40; = ; } private void button1_Click(object sender, EventArgs e) { //Set random colors Random r = new Random(); for (int i=0;i<5;i++) { // = ; = 303; //Thread: the route process for code execution //Method: End the brackets and semicolons, fill in the parameters in the brackets (20); = 303; (20); // = ; = 300; (20); = 297; (20); = 300; (20); = 297; (20); // = ; = 300; (20); = 307; (20); = 300; (20); = 300; // = ; } //Random color = ((256), (256), (256)); } } }
The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.