c# - Set simple timeout -


i've checked other questions in timeout in c#, since i'm beginner, don't know how implement them code. sophisticated.

i have text box , added click event. upon click, user copies content of text box clipboard. make copy process noticeable user, change color of text box. once content copied, want change color of text box normal. need set timeout.

private void idbox_click(object sender, eventargs e) {     copytoclipboard((textbox)sender); }  private void copytoclipboard(textbox textbox) {     if (textbox.text != "")     {         textbox.backcolor = system.drawing.color.mistyrose;          clipboard.settext(textbox.text);          // set 200ms timeout , change backcolor         //textbox.backcolor = system.drawing.systemcolors.window;     } } 

how can set timeout? example great.

not sure if fits requirements (beginner?), simple blinking using task , invoking text color changing after delay:

textbox.backcolor = color.mistyrose; task.run(() => {     thread.sleep(200); // delay     this.begininvoke((methodinvoker)delegate     {         textbox.backcolor = systemcolors.window;     }); }); 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -