C # Create a winfrom window from Notepad

Source: Internet
Author: User

1 usingSystem;2 usingSystem.Windows.Forms;3 4 //Version Number: 1.05[Assembly:System.Reflection.AssemblyVersion ("1.1")]6 7 //name Space8 namespaceUKE. Winform.demo9 {Ten     //window class: Default Inheritance System.Windows.Forms.Form class One      Public classMyForm:System.Windows.Forms.Form A     { -         //declaring a control instance -         PrivateButton BtnLoad;//button Btload the         PrivatePictureBox Pbphoto;//Picture Controls -          -          -         //Initialize the control (in the constructor), this represents the window +          PublicMyForm () -         { +             //Window Title A              This. Text ="Hello World 1.1"; at              -             //button btload; -BtnLoad =NewButton (); -Btnload.text ="Loading Pictures";//button Name -Btnload.left =Ten;//button X coordinate -Btnload.top =Ten;//button Y coordinate in              -             //Picture Controls toPbphoto =NewPictureBox (); +Pbphoto.borderstyle =Borderstyle.fixed3d; -Pbphoto.width = This. Width/2;//Picture Control width thePbphoto.height = This. Height/2;//Picture Control Height *Pbphoto.left = ( This. Width-pbphoto.width)/2;//picture Control x-coordinate $Pbphoto.top = ( This. Height-pbphoto.height)/2;//picture Control y-coordinatePanax Notoginseng              -             //The Add () method adds the control in the Window collection the              This. Controls.Add (BtnLoad);//button btnload Add in +              This. Controls.Add (Pbphoto);//Add a picture control A              the         } +          -          $         //Program Entry $[System.stathread]//multithreaded Mode -          Public Static voidMain () -         { the             //Enable system interface style effects - System.Windows.Forms.Application.EnableVisualStyles ();WuyiSystem.Windows.Forms.Application.Run (NewMyForm ()); the         } -          Wu          -     } About}

C # Create a winfrom window from Notepad

Related Article

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.