using System;
using System.Drawing;
using System.Windows.Forms;
using System.IO; // for File, StreamReader
using System.Text; // for Encoding
//★ Dialog Class
class MyDialog : Form
{
public TextBox txtBox;
public string str; //取得KeyWord
public MyDialog()
{
Text = "Dialog Text Input";
MaximizeBox = false;
MinimizeBox = false;
ControlBox = false;
ShowInTaskbar = false;
FormBorderStyle = FormBorderStyle.FixedDialog;
Width = 250;
Height = 130;
Button btnOK = new Button();
btnOK.Text = "OK";
btnOK.Location = new Point(30, ClientSize.Height - btnOK.Height - 5);
btnOK.Parent = this;
btnOK.TabIndex = 1;
btnOK.Click += new EventHandler(btnOK_Click);
btnOK.DialogResult = DialogResult.OK;
Button btnCancel = new Button();
btnCancel.Text = "Cancel";
btnCancel.Location = new Point(ClientSize.Width - btnCancel.Width - 30,
ClientSize.Height - btnCancel.Height - 5);
btnCancel.Parent = this;
btnCancel.TabIndex = 2;
btnCancel.DialogResult = DialogResult.Cancel;
txtBox = new TextBox();
txtBox.Parent = this;
txtBox.Location = new Point(10, 10);
txtBox.Width = ClientSize.Width - 20;
txtBox.TabIndex = 0;
}
void btnOK_Click(object sender, EventArgs e)
{ str = txtBox.Text; }
}
class RepDialog : Form
{
public TextBox k_Box;
public TextBox r_Box;
public string k_str; //KeyWord
public string r_str; //Replace
public RepDialog()
{
Text = "Dialog Text Input";
MaximizeBox = false;
MinimizeBox = false;
ControlBox = false;
ShowInTaskbar = false;
FormBorderStyle = FormBorderStyle.FixedDialog;
Width = 250;
Height = 130;
Button btnOK = new Button();
btnOK.Text = "OK";
btnOK.Location = new Point(30, ClientSize.Height - btnOK.Height - 5);
btnOK.Parent = this;
btnOK.TabIndex = 2;
btnOK.Click += new EventHandler(btnOK_Click);
btnOK.DialogResult = DialogResult.OK;
Button btnCancel = new Button();
btnCancel.Text = "Cancel";
btnCancel.Location = new Point(ClientSize.Width - btnCancel.Width - 30,
ClientSize.Height - btnCancel.Height - 5);
btnCancel.Parent = this;
btnCancel.TabIndex = 3;
btnCancel.DialogResult = DialogResult.Cancel;
k_Box = new TextBox();
k_Box.Parent = this;
k_Box.Location = new Point(10, 10);
k_Box.Width = ClientSize.Width - 20;
k_Box.TabIndex = 0;
r_Box = new TextBox();
r_Box.Parent = this;
r_Box.Location = new Point(10, 36);
r_Box.Width = ClientSize.Width - 20;
r_Box.TabIndex = 1;
}
void btnOK_Click(object sender, EventArgs e)
{
k_str = k_Box.Text;
r_str = r_Box.Text;
}
}
|