Advertisement
hiro1357

C# Form Application Skeleton

Dec 15th, 2015
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. ---make.bat---
  2. @echo off
  3. for /f "usebackq" %%d in (`dir/w %WINDIR%\Microsoft.NET\Framework ^| findstr [v`) do set dotnetdir=%%d
  4. set dotnetdir=%dotnetdir:[=%
  5. set dotnetdir=%dotnetdir:]=%
  6. rem echo %dotnetdir%
  7. set CSCOMPILER=%windir%\Microsoft.NET\Framework\%dotnetdir%\csc.exe
  8.  
  9. %CSCOMPILER% /target:winexe /main:App /platform:anycpu /out:skeleton.exe Main.cs Form1.cs
  10. pause
  11. ---end make.bat---
  12.  
  13. ---Main.cs---
  14. using System;
  15. using System.Windows.Forms;
  16.  
  17.  
  18. class App
  19. {
  20. [STAThread]
  21. static void Main()
  22. {
  23. Application.EnableVisualStyles();
  24. Application.Run(new Form1());
  25. }
  26. }
  27. ---end Main.cs---
  28.  
  29. ---Form1.cs---
  30. using System;
  31. using System.Windows.Forms;
  32.  
  33.  
  34. class Form1 : Form
  35. {
  36. static Button Button1;
  37.  
  38. public Form1()
  39. {
  40. Button1 = new Button();
  41. Button1.Top = 10;
  42. Button1.Left = 10;
  43. Button1.Text = "hello";
  44. Button1.Click += new EventHandler(Button1_Click);
  45. this.Controls.Add(Button1);
  46. }
  47.  
  48. private void Button1_Click(object sender, System.EventArgs e)
  49. {
  50. MessageBox.Show("hello");
  51. }
  52. }
  53. ---end Form1.cs---
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement