C # winform keyboard key control operation mobile control, linklabel, get key value, a Russian box source code

Source: Internet
Author: User

Call the start method to start a default Internet browser.

 
System. Diagnostics. process. Start ("http://www.baidu.com ");

Form1 button mobile control

C # Code
Using system; using system. collections. generic; using system. componentmodel; using system. data; using system. drawing; using system. text; using system. windows. forms; namespace man100 {public partial class form1: FORM {public form1 () {initializecomponent ();} public static int buchang = 5; private void form1_keydown (Object sender, keyeventargs E) {// MessageBox. show (E. keyValue. tostring (); // specifies the int value of the key. // MessageBox. show (E. keycode. tostring (); // used to find the key value if (E. keycode. tostring (). equals ("Left") // left {// MessageBox. show ("Left"); // label1.location = new point (0, 0); int x_zuobiao = label1.location. x; int y_zuobiao = label1.location. y; If (label1.location. x <15) {label1.location = new point (x_zuobiao, y_zuobiao); return;} label1.location = new point (x_zuobiao-buchang, y_zuobiao);} else if (E. keycode. tostring (). equals ("up") // {// MessageBox. show ("On"); int x_zuobiao = label1.location. x; int y_zuobiao = label1.location. y; If (label1.location. Y <15) {label1.location = new point (x_zuobiao, y_zuobiao); return;} label1.location = new point (x_zuobiao, y_zuobiao-buchang);} else if (E. keycode. tostring (). equals ("right") // right {// MessageBox. show ("right"); int x_zuobiao = label1.location. x; int y_zuobiao = label1.location. y; If (label1.location. x> 265) {label1.location = new point (x_zuobiao, y_zuobiao); return;} label1.location = new point (x_zuobiao + buchang, y_zuobiao);} else if (E. keycode. tostring (). equals ("down") // {// MessageBox. show ("bottom"); int x_zuobiao = label1.location. x; int y_zuobiao = label1.location. y; If (label1.location. y> 395) // if the limit is exceeded, {label1.location = new point (x_zuobiao, y_zuobiao); return;} label1.location = new point (x_zuobiao, y_zuobiao + buchang );}}}}
Form2
Linklabel usage
C # code
Using system; using system. collections. generic; using system. componentmodel; using system. data; using system. drawing; using system. text; using system. windows. forms; namespace man100 {public partial class form2: FORM {public form2 () {initializecomponent (); this. linklabel1.text = "black hair Baidu Google Yahoo"; this. linklabel1.links. add (0, 4, "http://www.heisetoufa.javaeye.com"); // The first parameter sets where the underline starts and the second parameter sets The underline occupies several lengths. This. linklabel1.links. add (5, 2, "http://www.baidu.com"); this. linklabel1.links. add (8, 6, "http://www.google.com");} private void linklabel1_linkclicked (Object sender, linklabellinkclickedeventargs e) {This. linklabel1.links [linklabel1.links. indexof (E. link)]. visited = true; string target = E. link. linkdata as string; If (target! = NULL & target. startswith ("http: //") {system. diagnostics. process. start (target);} else {MessageBox. show ("item clicked:" + target );}}}}
Turn from black hair: http://heisetoufa.javaeye.com/blog/348167source code download:

Man100.rar (34.7 KB)

C0000000000block source code .rar (168 KB)

Call the start method to start a default Internet browser.

 
System. Diagnostics. process. Start ("http://www.baidu.com ");

Form1 button mobile control

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.