private void InitializeComponent(int h = 300, int w = 200) { // // Controls initialization // CONTENT = new TextBox(); OK = new JUIButton(); NO = new JUIButton(); // // JUIMessageBox // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Name = "JustUIMessageBox"; this.Width = w; this.Height = h; AeroCheck(); Size = new Size(h, w); StartPosition = FormStartPosition.CenterScreen; KeyDown += (o, e) => { switch ((Keys)e.KeyCode) { case Keys.Enter: OK.PerformClick(); break; case Keys.Escape: X.PerformClick(); break; } }; // OK Button properties. OK.Text = "Yes"; OK.DialogResult = DialogResult.OK; OK.SetColors(1); NO.Text = "No"; NO.DialogResult = X.DialogResult = DialogResult.No; NO.SetColors(2); // Message box Title(Caption) properties. TITLE.Text = "---"; // Message box content properties. CONTENT.Text = "...\r\n......"; CONTENT.BorderStyle = BorderStyle.None; CONTENT.Font = new Font("Segoe UI Symbol", 10); CONTENT.ReadOnly = true; CONTENT.TabStop = false; CONTENT.HideSelection = true; CONTENT.Cursor = Cursors.Arrow; CONTENT.Multiline = true; CONTENT.BackColor = this.BackColor; // Add the controls to form. Controls.Add(CONTENT); Controls.AddRange(new [] { OK, NO }); }
private void InitializeComponent() { // // Controls initialization // TITLE = new JUITitle(); _ = new JUIButton(); X = new JUIButton(); // // JUIForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Text = "JUIForm"; this.Name = "JUIForm"; this.FormBorderStyle = FormBorderStyle.None; this.BackColor = Color.FromKnownColor(KnownColor.Window); this.ShowInTaskbar = true; this.Activated += (o, e) => { TITLE.Focus(); TITLE.Invalidate(); }; this.Deactivate += (o, e) => { TITLE.Focus(); TITLE.Invalidate(); }; // // Title & Min/Close buttons // X.Width = 23; X.Text = "X"; X.TabStop = false; X.Click += (o, e) => this.Close(); _.Width = 23; _.Text = "_"; _.TabStop = false; _.Click += (o, e) => this.WindowState = FormWindowState.Minimized; X.SetColors(2); TITLE.Font = new Font("Segoe UI Bold", 12); // // Controls addings // this.Controls.Add(X); this.Controls.Add(_); this.Controls.Add(TITLE); }
/// <summary> /// This method is required for Windows Forms designer support. /// Do not change the method contents inside the source code editor. The Forms designer might /// not be able to load this method if it was changed manually. /// </summary> private void InitializeComponent() { this.X = new JustUI.JUIButton(); this.TITLE = new JustUI.JUITitle(); this.pan_Translations = new Mahou.TranslatePanel.ColorPanel(); this.txt_Source = new System.Windows.Forms.TextBox(); this.bull = new System.Windows.Forms.Button(); this.SuspendLayout(); // // X // this.X.BackColor = System.Drawing.SystemColors.Window; this.X.FlatAppearance.BorderSize = 0; this.X.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(47)))), ((int)(((byte)(79)))), ((int)(((byte)(79))))); this.X.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(211)))), ((int)(((byte)(211)))), ((int)(((byte)(211))))); this.X.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.X.ForeColor = System.Drawing.SystemColors.WindowText; this.X.Location = new System.Drawing.Point(140, 0); this.X.Name = "X"; this.X.Size = new System.Drawing.Size(22, 23); this.X.TabIndex = 0; this.X.TabStop = false; this.X.Text = "X"; this.X.UseVisualStyleBackColor = true; this.X.MouseUp += new System.Windows.Forms.MouseEventHandler(this.XClick); // // TITLE // this.TITLE.BackColor = System.Drawing.SystemColors.Window; this.TITLE.ForeColor = System.Drawing.SystemColors.WindowText; this.TITLE.Location = new System.Drawing.Point(0, 0); this.TITLE.Name = "TITLE"; this.TITLE.Size = new System.Drawing.Size(100, 23); this.TITLE.TabIndex = 1; this.TITLE.Text = "Translation"; this.TITLE.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // pan_Translations // this.pan_Translations.Location = new System.Drawing.Point(13, 67); this.pan_Translations.Name = "pan_Translations"; this.pan_Translations.Size = new System.Drawing.Size(149, 71); this.pan_Translations.TabIndex = 3; // // txt_Source // this.txt_Source.BorderStyle = System.Windows.Forms.BorderStyle.None; this.txt_Source.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.txt_Source.Location = new System.Drawing.Point(13, 28); this.txt_Source.Name = "txt_Source"; this.txt_Source.ReadOnly = true; this.txt_Source.Size = new System.Drawing.Size(100, 13); this.txt_Source.TabIndex = 4; this.txt_Source.TabStop = false; this.txt_Source.Text = "source text"; // // bull // this.bull.Location = new System.Drawing.Point(0, 0); this.bull.Name = "bull"; this.bull.Size = new System.Drawing.Size(0, 0); this.bull.TabIndex = 5; this.bull.Text = "bull"; this.bull.UseVisualStyleBackColor = true; // // TranslatePanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Window; this.ClientSize = new System.Drawing.Size(172, 179); this.ControlBox = false; this.Controls.Add(this.bull); this.Controls.Add(this.txt_Source); this.Controls.Add(this.pan_Translations); this.Controls.Add(this.TITLE); this.Controls.Add(this.X); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.MaximizeBox = false; this.MaximumSize = new System.Drawing.Size(600, 400); this.MinimizeBox = false; this.MinimumSize = new System.Drawing.Size(40, 24); this.Name = "TranslatePanel"; this.Opacity = 0.9D; this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.Text = "TranslatePanel"; this.TopMost = true; this.TransparencyKey = System.Drawing.Color.Peru; this.Deactivate += new System.EventHandler(this.TranslatePanelDeactivate); this.ResumeLayout(false); this.PerformLayout(); }