mirror of
https://github.com/spiffcode/hostile-takeover.git
synced 2025-12-16 12:08:36 +00:00
133 lines
4.0 KiB
C#
133 lines
4.0 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using System.Windows.Forms;
|
|
|
|
namespace m
|
|
{
|
|
/// <summary>
|
|
/// Summary description for EditStringForm.
|
|
/// </summary>
|
|
public class EditStringForm : System.Windows.Forms.Form
|
|
{
|
|
private System.Windows.Forms.Button buttonOk;
|
|
private System.Windows.Forms.Label label1;
|
|
private System.Windows.Forms.Button buttonCancel;
|
|
private System.Windows.Forms.TextBox textBox1;
|
|
/// <summary>
|
|
/// Required designer variable.
|
|
/// </summary>
|
|
private System.ComponentModel.Container components = null;
|
|
|
|
public EditStringForm(string strTitle, string strPrompt, string strCurrent)
|
|
{
|
|
//
|
|
// Required for Windows Form Designer support
|
|
//
|
|
InitializeComponent();
|
|
|
|
Text = strTitle;
|
|
label1.Text = strPrompt;
|
|
textBox1.Text = strCurrent;
|
|
}
|
|
|
|
static public string DoModal(string strTitle, string strPrompt, string strCurrent) {
|
|
EditStringForm frm = new EditStringForm(strTitle, strPrompt, strCurrent);
|
|
DialogResult res = frm.ShowDialog();
|
|
if (res == DialogResult.Cancel)
|
|
return null;
|
|
return frm.textBox1.Text;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Clean up any resources being used.
|
|
/// </summary>
|
|
protected override void Dispose( bool disposing )
|
|
{
|
|
if( disposing )
|
|
{
|
|
if(components != null)
|
|
{
|
|
components.Dispose();
|
|
}
|
|
}
|
|
base.Dispose( disposing );
|
|
}
|
|
|
|
#region Windows Form Designer generated code
|
|
/// <summary>
|
|
/// Required method for Designer support - do not modify
|
|
/// the contents of this method with the code editor.
|
|
/// </summary>
|
|
private void InitializeComponent()
|
|
{
|
|
this.buttonOk = new System.Windows.Forms.Button();
|
|
this.label1 = new System.Windows.Forms.Label();
|
|
this.buttonCancel = new System.Windows.Forms.Button();
|
|
this.textBox1 = new System.Windows.Forms.TextBox();
|
|
this.SuspendLayout();
|
|
//
|
|
// buttonOk
|
|
//
|
|
this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
this.buttonOk.Location = new System.Drawing.Point(56, 64);
|
|
this.buttonOk.Name = "buttonOk";
|
|
this.buttonOk.TabIndex = 1;
|
|
this.buttonOk.Text = "OK";
|
|
//
|
|
// label1
|
|
//
|
|
this.label1.Location = new System.Drawing.Point(8, 8);
|
|
this.label1.Name = "label1";
|
|
this.label1.Size = new System.Drawing.Size(264, 16);
|
|
this.label1.TabIndex = 4;
|
|
this.label1.Text = "Edit the text:";
|
|
//
|
|
// buttonCancel
|
|
//
|
|
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
|
this.buttonCancel.Location = new System.Drawing.Point(152, 64);
|
|
this.buttonCancel.Name = "buttonCancel";
|
|
this.buttonCancel.TabIndex = 2;
|
|
this.buttonCancel.Text = "Cancel";
|
|
//
|
|
// textBox1
|
|
//
|
|
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
|
this.textBox1.Location = new System.Drawing.Point(8, 24);
|
|
this.textBox1.Name = "textBox1";
|
|
this.textBox1.Size = new System.Drawing.Size(264, 22);
|
|
this.textBox1.TabIndex = 0;
|
|
this.textBox1.Text = "textBox1";
|
|
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
|
|
//
|
|
// EditStringForm
|
|
//
|
|
this.AcceptButton = this.buttonOk;
|
|
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
|
this.CancelButton = this.buttonCancel;
|
|
this.ClientSize = new System.Drawing.Size(282, 96);
|
|
this.Controls.AddRange(new System.Windows.Forms.Control[] {
|
|
this.textBox1,
|
|
this.buttonOk,
|
|
this.label1,
|
|
this.buttonCancel});
|
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
|
this.MaximizeBox = false;
|
|
this.MinimizeBox = false;
|
|
this.Name = "EditStringForm";
|
|
this.ShowInTaskbar = false;
|
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
|
this.Text = "Edit Text";
|
|
this.ResumeLayout(false);
|
|
|
|
}
|
|
#endregion
|
|
|
|
private void textBox1_TextChanged(object sender, System.EventArgs e) {
|
|
buttonOk.Enabled = textBox1.Text != "";
|
|
}
|
|
}
|
|
}
|