Guest User

Untitled

a guest
Oct 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1. import System;
  2. import System.Collections.Generic;
  3. import System.Windows.Forms;
  4. import System.Runtime.InteropServices;
  5. import System.Drawing;
  6. import System.ComponentModel;
  7. import Accessibility;
  8.  
  9. package JScript_Form {
  10. class Form1 extends Form {
  11. private var components: IContainer;
  12. private var textBox1: TextBox;
  13. private var label1: Label;
  14. private var button1: Button;
  15. private var label2: Label;
  16. public function Form1()
  17. {
  18. components = null;
  19.  
  20. this.textBox1 = new System.Windows.Forms.TextBox();
  21. this.label1 = new System.Windows.Forms.Label();
  22. this.button1 = new System.Windows.Forms.Button();
  23. this.label2 = new System.Windows.Forms.Label();
  24. this.SuspendLayout();
  25. //
  26. // textBox1
  27. //
  28. this.textBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
  29. this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
  30. this.textBox1.ForeColor = System.Drawing.Color.White;
  31. this.textBox1.Location = new System.Drawing.Point(12, 28);
  32. this.textBox1.Name = "textBox1";
  33. this.textBox1.Size = new System.Drawing.Size(212, 13);
  34. this.textBox1.TabIndex = 0;
  35. this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
  36. //
  37. // label1
  38. //
  39. this.label1.AutoSize = true;
  40. this.label1.ForeColor = System.Drawing.Color.Lime;
  41. this.label1.Location = new System.Drawing.Point(99, 9);
  42. this.label1.Name = "label1";
  43. this.label1.Size = new System.Drawing.Size(45, 13);
  44. this.label1.TabIndex = 1;
  45. this.label1.Text = "KeyGen";
  46. //
  47. // button1
  48. //
  49. this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
  50. this.button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
  51. this.button1.FlatAppearance.BorderSize = 0;
  52. this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
  53. this.button1.ForeColor = System.Drawing.Color.Lime;
  54. this.button1.Location = new System.Drawing.Point(149, 54);
  55. this.button1.Name = "button1";
  56. this.button1.Size = new System.Drawing.Size(75, 23);
  57. this.button1.TabIndex = 2;
  58. this.button1.Text = "Generate";
  59. this.button1.UseVisualStyleBackColor = false;
  60. //this.button1.Click += new System.EventHandler(this.button1_Click);
  61. this.button1.add_Click(this.button1_Click);
  62. //
  63. // label2
  64. //
  65. this.label2.AutoSize = true;
  66. this.label2.ForeColor = System.Drawing.Color.Lime;
  67. this.label2.Location = new System.Drawing.Point(216, 2);
  68. this.label2.Name = "label2";
  69. this.label2.Size = new System.Drawing.Size(20, 13);
  70. this.label2.TabIndex = 3;
  71. this.label2.Text = "[X]";
  72. //this.label2.Click += new System.EventHandler(this.label2_Click);
  73. this.label2.add_Click(this.label2_Click);
  74. //
  75. // Form1
  76. //
  77. //this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
  78. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  79. this.BackColor = System.Drawing.Color.Black;
  80. this.ClientSize = new System.Drawing.Size(236, 84);
  81. this.Controls.Add(this.label2);
  82. this.Controls.Add(this.button1);
  83. this.Controls.Add(this.label1);
  84. this.Controls.Add(this.textBox1);
  85. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
  86. this.Name = "Form1";
  87. this.Text = "Form1";
  88. this.ResumeLayout(false);
  89. this.PerformLayout();
  90. }
  91. private function button1_Click(sender: Object, e: EventArgs)
  92. {
  93. var serial: String = "";
  94. var letters: char[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".ToCharArray();
  95. var r: Random = new Random();
  96. for (var i = 0; i < 5; i++)
  97. {
  98. for (var j = 0; j < 4; j++)
  99. {
  100. serial += letters[r.Next(0, letters.Length - 1)];
  101. }
  102. if (i != 5 - 1) serial += '-';
  103. }
  104. textBox1.Text = serial;
  105. }
  106. private function label2_Click(sender: Object, e: EventArgs) { Application.Exit(); }
  107. }
  108. }
  109. /*
  110. Application.EnableVisualStyles();
  111. Application.SetCompatibleTextRenderingDefault(false);
  112. */
  113. Application.Run(new JScript_Form.Form1());
Add Comment
Please, Sign In to add comment