151 lines
6.5 KiB
C#
151 lines
6.5 KiB
C#
using RyzStudio.Windows.ThemedForms;
|
|
using System;
|
|
using System.ComponentModel;
|
|
using System.Windows.Forms;
|
|
|
|
namespace FizzyLauncher
|
|
{
|
|
public class PasswordForm : TDialogForm
|
|
{
|
|
private System.Windows.Forms.Label label1;
|
|
private TButton button1;
|
|
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator1;
|
|
private TTextBox textBox1;
|
|
|
|
|
|
public PasswordForm()
|
|
{
|
|
InitializeComponent();
|
|
|
|
this.StartPosition = FormStartPosition.WindowsDefaultLocation;
|
|
|
|
textBox1.TextBox.MaxLength = 255;
|
|
textBox1.PreviewKeyDown += textBox1_PreviewKeyDown;
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
this.label1 = new System.Windows.Forms.Label();
|
|
this.button1 = new RyzStudio.Windows.ThemedForms.TButton();
|
|
this.tHorizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
|
this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox();
|
|
this.SuspendLayout();
|
|
//
|
|
// label1
|
|
//
|
|
this.label1.AutoSize = true;
|
|
this.label1.BackColor = System.Drawing.Color.Transparent;
|
|
this.label1.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this.label1.Location = new System.Drawing.Point(10, 21);
|
|
this.label1.Margin = new System.Windows.Forms.Padding(0);
|
|
this.label1.Name = "label1";
|
|
this.label1.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
|
|
this.label1.Size = new System.Drawing.Size(57, 34);
|
|
this.label1.TabIndex = 153;
|
|
this.label1.Text = "Password";
|
|
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
|
//
|
|
// button1
|
|
//
|
|
this.button1.ActiveImage = null;
|
|
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
this.button1.BackColor = System.Drawing.Color.Transparent;
|
|
this.button1.HoverImage = null;
|
|
this.button1.IdleImage = null;
|
|
this.button1.LabelText = "&OK";
|
|
this.button1.Location = new System.Drawing.Point(321, 99);
|
|
this.button1.Margin = new System.Windows.Forms.Padding(10, 0, 0, 10);
|
|
this.button1.Name = "button1";
|
|
this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
|
|
this.button1.Size = new System.Drawing.Size(128, 32);
|
|
this.button1.TabIndex = 1;
|
|
this.button1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.button1_MouseClick);
|
|
//
|
|
// tHorizontalSeparator1
|
|
//
|
|
this.tHorizontalSeparator1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.tHorizontalSeparator1.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
|
this.tHorizontalSeparator1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
|
|
this.tHorizontalSeparator1.BackColor = System.Drawing.Color.Transparent;
|
|
this.tHorizontalSeparator1.Location = new System.Drawing.Point(10, 67);
|
|
this.tHorizontalSeparator1.Margin = new System.Windows.Forms.Padding(5, 0, 5, 10);
|
|
this.tHorizontalSeparator1.MaximumSize = new System.Drawing.Size(4920, 2);
|
|
this.tHorizontalSeparator1.MinimumSize = new System.Drawing.Size(0, 22);
|
|
this.tHorizontalSeparator1.Name = "tHorizontalSeparator1";
|
|
this.tHorizontalSeparator1.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10);
|
|
this.tHorizontalSeparator1.Size = new System.Drawing.Size(444, 22);
|
|
this.tHorizontalSeparator1.TabIndex = 188;
|
|
this.tHorizontalSeparator1.TabStop = false;
|
|
//
|
|
// textBox1
|
|
//
|
|
this.textBox1.AcceptButton = this.button1;
|
|
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.textBox1.BackColor = System.Drawing.Color.Transparent;
|
|
this.textBox1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
|
this.textBox1.Location = new System.Drawing.Point(121, 20);
|
|
this.textBox1.Margin = new System.Windows.Forms.Padding(10, 0, 0, 10);
|
|
this.textBox1.Name = "textBox1";
|
|
this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
|
|
this.textBox1.ReadOnly = false;
|
|
this.textBox1.Size = new System.Drawing.Size(328, 35);
|
|
this.textBox1.TabIndex = 0;
|
|
this.textBox1.UseSystemPasswordChar = true;
|
|
//
|
|
// PasswordForm
|
|
//
|
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
|
this.ClientSize = new System.Drawing.Size(464, 151);
|
|
this.Controls.Add(this.textBox1);
|
|
this.Controls.Add(this.tHorizontalSeparator1);
|
|
this.Controls.Add(this.button1);
|
|
this.Controls.Add(this.label1);
|
|
this.MinimumSize = new System.Drawing.Size(480, 190);
|
|
this.Name = "PasswordForm";
|
|
this.Text = "Password";
|
|
this.ResumeLayout(false);
|
|
this.PerformLayout();
|
|
|
|
}
|
|
|
|
protected override void OnShown(EventArgs e)
|
|
{
|
|
base.OnShown(e);
|
|
|
|
this.DialogResult = System.Windows.Forms.DialogResult.None;
|
|
|
|
textBox1.Focus();
|
|
}
|
|
|
|
|
|
[Browsable(false)]
|
|
public string Password => textBox1.Text;
|
|
|
|
|
|
private void textBox1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
|
|
{
|
|
switch (e.KeyCode)
|
|
{
|
|
case Keys.Enter:
|
|
button1_MouseClick(sender, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
|
|
break;
|
|
case Keys.Escape:
|
|
this.Close();
|
|
break;
|
|
default: break;
|
|
}
|
|
}
|
|
|
|
private void button1_MouseClick(object sender, MouseEventArgs e)
|
|
{
|
|
if (e.Button == MouseButtons.Left)
|
|
{
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
}
|
|
|
|
}
|
|
} |