本文整理汇总了C#中System.Windows.Forms.Button.Show方法的典型用法代码示例。如果您正苦于以下问题:C# Button.Show方法的具体用法?C# Button.Show怎么用?C# Button.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Button
的用法示例。
在下文中一共展示了Button.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: bt_connect_Click
private void bt_connect_Click(object sender, EventArgs e)
{
string serverip = Interaction.InputBox("Type in the IP where you want to join.", "Connect to a server", "csoty.ddns.net");
if (serverip.Length > 0)
{
try
{
clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPAddress ipAddress = Dns.GetHostEntry(serverip).AddressList[0];
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, 3333);
clientSocket.BeginConnect(ipEndPoint, new AsyncCallback(OnConnect), clientSocket);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
tBox_msg.Enabled = true;
bt_send.Enabled = true;
Button bt_dc = new Button();
bt_dc.Text = "Disconnect";
bt_dc.Top = bt_connect.Top + bt_connect.Height + 5;
bt_dc.Left = bt_connect.Left;
bt_dc.Click += new EventHandler(bt_dc_Click);
this.Controls.Add(bt_dc);
bt_dc.Show();
lb_constatus.Text = "Connected";
lb_ip.Text = Dns.GetHostEntry(serverip).AddressList[0].ToString();
lb_constatus.ForeColor = lb_ip.ForeColor = Color.Green;
}
}
示例2: AddScreenshot
public void AddScreenshot(Image Screenshot)
{
try
{
PictureBox nPB = new PictureBox();
nPB.MouseDown += pbScreenshot_MouseDown;
nPB.Parent = flpScreenshots;
nPB.SizeMode = PictureBoxSizeMode.StretchImage;
nPB.BorderStyle = BorderStyle.FixedSingle;
nPB.ContextMenuStrip = cMenScreenshot;
nPB.Image = Screenshot;
nPB.Size = new Size(100, 100); //New Size((Screenshot.Width / 100) * 20, (Screenshot.Height / 100) * 20)
nPB.Show();
Button nBtn = new Button();
nBtn.Click += btnCloseScreenshot_Click;
nBtn.Parent = nPB;
nBtn.FlatStyle = FlatStyle.Flat;
nBtn.Text = "×";
nBtn.Size = new Size(22, 22);
nBtn.Location = new Point(nPB.Width - nBtn.Width, -1);
nBtn.Show();
Show(frmMain.Default.pnlDock);
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "AddScreenshot (UI.Window.ScreenshotManager) failed" + Environment.NewLine + ex.Message, true);
}
}
示例3: NewMapDlg
public NewMapDlg()
: base()
{
FormBorderStyle = FormBorderStyle.FixedDialog;
Label t = new Label();
t.Text = "Width";
t.Location = new Point(10, 10);
t.Show();
Label u = new Label();
u.Text = "Height";
u.Location = new Point(t.Left, t.Bottom + 5);
u.Show();
widthbox = new TextBox();
widthbox.Location = new Point(t.Right + 5, 10);
widthbox.Show();
heightbox = new TextBox();
heightbox.Location = new Point(widthbox.Left, widthbox.Bottom + 5);
heightbox.Show();
Button okbutton = new Button();
okbutton.Text = "OK";
okbutton.DialogResult = DialogResult.OK;
okbutton.Location = new Point(t.Left, u.Bottom + 5);
okbutton.Show();
Button cancelbutton = new Button();
cancelbutton.Text = "Cancel";
cancelbutton.DialogResult = DialogResult.Cancel;
cancelbutton.Location = new Point(okbutton.Right + 5, okbutton.Top);
cancelbutton.Show();
Controls.Add(t);
Controls.Add(u);
Controls.Add(widthbox);
Controls.Add(heightbox);
Controls.Add(okbutton);
Controls.Add(cancelbutton);
AcceptButton = okbutton;
CancelButton = cancelbutton;
Width = heightbox.Right + 35;
Height = okbutton.Bottom + 35;
}
示例4: AboutGUI
public AboutGUI()
{
this.Width = 415;
this.Height = 345;
this.Text = "About";
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.StartPosition = FormStartPosition.CenterParent;
this.ControlBox = false;
Panel frame = new Panel();
frame.BorderStyle = BorderStyle.FixedSingle;
frame.Left = 15;
frame.Width = 380;
frame.Top = 15;
frame.Height = 258;
frame.Show();
this.Controls.Add( frame );
Label about = new Label();
//about.BackColor = System.Drawing.Color.Green;
about.Left = 2;
about.Width = frame.Width - 4;
about.Top = 2;
about.Height = frame.Height - 4;
about.Show();
frame.Controls.Add( about );
string a = "";
a += "This backgammon program is freeware and has been part of a Master thesis on intelligent game agents. The original program and its associated paper were composed by Mikael Heinze at Aalborg University Esbjerg in Denmark in the period 2nd February to 21st December 2004.\n\n";
a += "The programs purpose was to work as a problem/test domain for an adaptive and intelligent computer player named Fuzzeval based on fuzzy logic and fuzzy control. For evaluation purpose other computer players based on other principles has also been implemented. To configure an opponent (agent) one can select what decision module that is to be used for move and cube evaluation.\n\n";
a += "This is however a greatly improved version of this original backgammon program completed at the 26th of April 2005. This version includes a large range of new features, improvements and bug fixes. Examples are a stronger computer opponent named TD-NN 2 and implementation of the cube. It is however only the two TD-NN evaluators that in reality supports cube handling.\n\n";
a += "Happy playing.";
about.Text = a;
Button ok = new Button();
ok.Text = "OK";
ok.Left = 320;
ok.Top = 280;
ok.Click += new EventHandler(ok_Click);
ok.Show();
this.Controls.Add( ok );
}
示例5: bt_connect_Click
private void bt_connect_Click(object sender, EventArgs e)
{
string serverip = Interaction.InputBox("Type in the IP where you want to join.", "Connect to a server", "csoty.ddns.net");
if (serverip.Length > 0)
{
try
{
clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPAddress ipAddress = Dns.GetHostEntry(serverip).AddressList[0];
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, 3333);
clientSocket.BeginConnect(ipEndPoint, new AsyncCallback(OnConnect), null);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
tBox_msg.Enabled = true;
bt_send.Enabled = true;
Button bt_dc = new Button();
bt_dc.Text = "Disconnect";
bt_dc.Top = bt_connect.Top + bt_connect.Height + 5;
bt_dc.Left = bt_connect.Left;
bt_dc.Click += new EventHandler(bt_dc_Click);
this.Controls.Add(bt_dc);
bt_dc.Show();
try
{
Data sendMsg = new Data();
sendMsg.cmd = Command.List;
sendMsg.user = user;
sendMsg.Msg = null;
byteData = sendMsg.toByte();
clientSocket.BeginReceive(byteData, 0, byteData.Length, SocketFlags.None, new AsyncCallback(OnRecieve), null);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
示例6: SeedSelector
public SeedSelector()
{
this.Width = 160;
this.Height = 190;
this.Text = "Set dice seed";
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.StartPosition = FormStartPosition.CenterParent;
this.ControlBox = false;
m_Random = new CheckBox();
m_Random.Text = "Random";
m_Random.Checked = true;
m_Random.Top = 20;
m_Random.Left = 20;
m_Random.CheckedChanged += new EventHandler(m_UseSeed_CheckedChanged);
this.Controls.Add( m_Random );
Label seedLabel = new Label();
seedLabel.Text = "Seed value";
seedLabel.AutoSize = true;
seedLabel.Top = 60;
seedLabel.Left = 18;
this.Controls.Add( seedLabel );
m_Seed = new NumericUpDown();
m_Seed.Maximum = 2147483647;
m_Seed.Minimum = 0;
m_Seed.Value = new Random().Next( 0, 2147483647 );
m_Seed.Enabled = false;
m_Seed.Top = 78;
m_Seed.Left = 18;
m_Seed.Leave += new EventHandler(m_Seed_Leave);
m_Seed.KeyPress += new KeyPressEventHandler(m_Seed_KeyPress);
this.Controls.Add( m_Seed );
Button ok = new Button();
ok.Text = "OK";
ok.Left = 38;
ok.Top = 118;
ok.Click += new EventHandler(ok_Click);
ok.Show();
this.Controls.Add( ok );
}
示例7: populateUsers
// Yeah, yeah, so I should probably make this accept params. We'll see if it happens later on.
private void populateUsers()
{
// Also shoutout to automatic definition handling
// Ah, C#, it's great to be here again.
// Go through each user
// (could have also used the count from anything else that holds a user property)
for (int i = 0; i < Properties.Settings.Default.username.Count; i++)
{
int t = 0;
Panel uA = new Panel();
uA.Show();
uA.BackColor = Color.White;
//uA.BackColor = Color.FromName(Properties.Settings.Default.custColor[i]);
uA.Left = 0;
uA.Width = this.Width;
uA.Height = 50;
uA.Margin = new Padding(0, 2, 0, 0);
userList.Controls.Add(uA);
PictureBox pImg = new PictureBox();
pImg.Image = Image.FromFile(Properties.Settings.Default.userimgacc_path[i]);
pImg.Left = 0;
pImg.Width = 50;
pImg.Height = 50;
pImg.Dock = DockStyle.Left;
pImg.BackColor = Color.White;
pImg.SizeMode = PictureBoxSizeMode.Zoom;
Label turnip = new Label();
turnip.Show();
turnip.BackColor = Color.Transparent;
turnip.AutoEllipsis = true;
turnip.Left = 64;
turnip.Width = this.Width - 64 - 50;
turnip.Height = 50;
turnip.Top = 0;
turnip.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 11);
turnip.ForeColor = Color.DimGray;
//turnip.ForeColor = Color.White;
turnip.TextAlign = ContentAlignment.MiddleLeft;
turnip.Text = Properties.Settings.Default.username[i];
uA.Controls.Add(pImg);
uA.Controls.Add(turnip);
Button dl = new Button();
dl.Show();
dl.BackColor = Color.Firebrick;
dl.Width = 50;
dl.Left = uA.Width - 50;
dl.Height = 50;
dl.Dock = DockStyle.Right;
dl.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 11);
dl.ForeColor = Color.White;
dl.TextAlign = ContentAlignment.MiddleCenter;
dl.Text = "X";
dl.FlatStyle = FlatStyle.Flat;
dl.FlatAppearance.BorderSize = 0;
uA.Controls.Add(dl);
// Shhhhhhhhhhh hidden controls
Label toDel = new Label();
toDel.Show();
toDel.BackColor = Color.Transparent;
toDel.AutoEllipsis = true;
toDel.Left = 64;
toDel.Width = this.Width - 64 - 50;
toDel.Height = 18;
toDel.Top = 50;
toDel.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 11);
toDel.ForeColor = Color.Red;
toDel.TextAlign = ContentAlignment.MiddleLeft;
toDel.Text = "To delete this account, enter the password:";
uA.Controls.Add(toDel);
TextBox pBox = new TextBox();
pBox.Show();
pBox.BackColor = Color.White;
pBox.Left = 64;
pBox.Width = this.Width - 64 - 60;
pBox.Top = 76;
pBox.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 11);
pBox.ForeColor = Color.Black;
pBox.PasswordChar = '•';
pBox.BorderStyle = BorderStyle.FixedSingle;
uA.Controls.Add(pBox);
//.........这里部分代码省略.........
示例8: AddTimelineTrack
public void AddTimelineTrack(string name)
{
if (!_timeline_tracks.ContainsKey(name))
{
Button b = new Button();
b.Height = TickHeight;
TrackPanel.VerticalScroll.SmallChange = TickHeight;
TrackPanel.VerticalScroll.LargeChange = TickHeight;
b.Text = name;
b.MouseClick += new MouseEventHandler(this.TimelineTrackClicked);
b.TextAlign = ContentAlignment.MiddleCenter;
b.Parent = TrackPanel;
b.Dock = DockStyle.Top;
b.BringToFront();
b.Show();
_timeline_tracks.Add(b.Text, new EventTimeline(b.Text, b, new SortedDictionary<int, RectangleF>()));
SelectTimelineTrack(name);
}
else
{
MessageBox.Show("The requested Track exists already.", "Error adding Timeline Track", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
示例9: beginEditIncludeDir
private void beginEditIncludeDir()
{
if(_editingIncludes)
{
endEditIncludeDir(true);
}
_editingIncludes = true;
_dialog.unsetCancelButton();
if(_editingIndex != -1)
{
_txtIncludeDir = new TextBox();
_txtIncludeDir.Text = sliceIncludeList.Items[sliceIncludeList.SelectedIndex].ToString();
_editingIncludeDir = _txtIncludeDir.Text;
sliceIncludeList.SelectionMode = SelectionMode.One;
Rectangle rect = sliceIncludeList.GetItemRectangle(sliceIncludeList.SelectedIndex);
_txtIncludeDir.Location = new Point(sliceIncludeList.Location.X + 2,
sliceIncludeList.Location.Y + rect.Y);
_txtIncludeDir.Width = sliceIncludeList.Width - 50;
_txtIncludeDir.Parent = sliceIncludeList;
_txtIncludeDir.KeyDown += new KeyEventHandler(includeDirKeyDown);
_txtIncludeDir.KeyUp += new KeyEventHandler(includeDirKeyUp);
groupBox1.Controls.Add(_txtIncludeDir);
_btnSelectInclude = new Button();
_btnSelectInclude.Text = "...";
_btnSelectInclude.Location = new Point(sliceIncludeList.Location.X + _txtIncludeDir.Width,
sliceIncludeList.Location.Y + rect.Y);
_btnSelectInclude.Width = 49;
_btnSelectInclude.Height = _txtIncludeDir.Height;
_btnSelectInclude.Click += new EventHandler(selectIncludeClicked);
groupBox1.Controls.Add(_btnSelectInclude);
_txtIncludeDir.Show();
_txtIncludeDir.BringToFront();
_txtIncludeDir.Focus();
_btnSelectInclude.Show();
_btnSelectInclude.BringToFront();
}
}
示例10: multiMonitorSetup
/// <summary>1
/// Setup multiple monitor wizard
/// </summary>
/// <param name="isFreshInstall">true if this is a new install, false if just a monitor switch</param>
private void multiMonitorSetup(bool isFreshInstall)
{
//alert the user as to what is going on, only if this is a new install
if (isFreshInstall == true)
{
MessageBox.Show("Hello! cDashBoard has detected that you have " + Screen.AllScreens.Count().ToString() + " Monitors. So this little wizard will allow cDashBoard to be setup and appear properly. After clicking Ok, you will see giant big white boxes over each monitor. Click the box on the monitor you want cDashBoard to appear on. Don't worry this can be changed later.", "cDashboard Multi-Monitor Setup");
}
//make the boxes appear
foreach (Screen s in Screen.AllScreens)
{
//create a form that will overlay Screen s
Form form_tmp = new Form();
form_tmp.Click += new EventHandler(Monitor_Overlay_Click);
form_tmp.Opacity = .9;
form_tmp.Name = "Multi_Monitor_Selection_Overlay";
form_tmp.WindowState = FormWindowState.Normal;
form_tmp.StartPosition = FormStartPosition.Manual;
form_tmp.Location = s.Bounds.Location;
form_tmp.FormBorderStyle = FormBorderStyle.None;
form_tmp.SizeGripStyle = SizeGripStyle.Hide;
form_tmp.WindowState = FormWindowState.Maximized;
form_tmp.TopMost = true;
form_tmp.Show();
//create label for the new form
Label label_monitor_name = new Label();
form_tmp.Controls.Add(label_monitor_name);
label_monitor_name.Show();
label_monitor_name.AutoSize = true;
//make the label talk about the monitor
label_monitor_name.Text = "Click the monitor you would like to use for cDashBoard\n" + s.ToString();
label_monitor_name.Location = new Point((form_tmp.Width / 2) - label_monitor_name.Width / 2, (form_tmp.Height / 2) - label_monitor_name.Height / 2);
//add span button
Button button_span = new Button();
form_tmp.Controls.Add(button_span);
button_span.Show();
button_span.AutoSize = true;
button_span.FlatStyle = FlatStyle.Flat;
button_span.Text = "Span All Monitors";
button_span.Location = new Point(5, 5);
button_span.Click += new EventHandler(Multi_Monitor_button_span_Click);
if (isFreshInstall == false)
{
//add a cancel button to each form
Button button_cancel = new Button();
form_tmp.Controls.Add(button_cancel);
button_cancel.Show();
button_cancel.AutoSize = true;
button_cancel.FlatStyle = FlatStyle.Flat;
button_cancel.Text = "Cancel";
button_cancel.Location = new Point(button_span.Location.X + button_span.Size.Width + 5, 5);
button_cancel.Click += new EventHandler(Mult_Monitor_button_cancel_Click);
}
}
}
示例11: ShowInfoPage
public void ShowInfoPage()
{
this.SuspendLayout();
WebBrowser webStart = new WebBrowser();
PNLlist.Controls.Add(webStart);
webStart.Visible = false;
webStart.ScriptErrorsSuppressed = true;
webStart.ScrollBarsEnabled = false;
webStart.Dock = DockStyle.Fill;
webStart.BringToFront();
Button btnClose = new Button();
this.Controls.Add(btnClose);
btnClose.Visible = false;
btnClose.Size = new Size(PNLlist.Width - 6, 35);
btnClose.Location = new Point(15, PNLlist.Height - 39 + 39);
btnClose.FlatAppearance.BorderColor = Color.Gray;
btnClose.BackColor = Color.FromArgb(64, 64, 64);
btnClose.ForeColor = Color.WhiteSmoke;
btnClose.Text = "Close";
btnClose.FlatStyle = FlatStyle.Flat;
btnClose.BringToFront();
this.ResumeLayout();
btnClose.Click += (e, s) =>
{
PNLlist.Controls.Remove(webStart);
this.Controls.Remove(btnClose);
};
webStart.Navigated += (e, s) =>
{
if (!webStart.Document.ToString().ToLower().Contains("checking your"))
{
webStart.Show();
btnClose.Show();
}
};
webStart.Navigate("http://www.realmbot.xyz/hello.html");
}
示例12: OnCellMouseDown
private void OnCellMouseDown(MyDataGridView dataGridViewCharacters, ref Button btnZoom, Font font, TableLayoutPanel ZoomButtonParent,
SendToEditorForms eOutputForm, bool bIsLegacy, DataGridViewCellMouseEventArgs e)
{
if ((e.RowIndex >= 0) && (e.ColumnIndex >= 0))
{
m_mbButtonDown = e.Button;
DataGridViewCell aCell = dataGridViewCharacters.Rows[e.RowIndex].Cells[e.ColumnIndex];
if (m_mbButtonDown == MouseButtons.Right)
{
// simply selecting the cell will trigger the zoom button update
// (but only if it's already activated)
if (btnZoom == null)
ShowZoomButton(ref btnZoom, font, ZoomButtonParent, eOutputForm, bIsLegacy, aCell);
else if (!btnZoom.Visible)
btnZoom.Show();
// either way, select the cell
aCell.Selected = true;
}
}
}
示例13: LoadSearchConfig
public void LoadSearchConfig(String EditConfigFile)
{
this.ConfigFile = EditConfigFile;
if (!File.Exists(this.ConfigFile))
return;
using (StreamReader sr = new StreamReader(this.ConfigFile))
{
String line;
int cLine = 0;
// Read and display lines from the file until the end of
// the file is reached.
while ((line = sr.ReadLine()) != null)
{
cLine++;
if ((cLine == 1) && (line != "editor.config.begin"))
return; /* invalid or corrupt config file */
string[] cfgLine = line.Split('^');
if (cfgLine[0] == "set.editor.title")
{
this.EditorTitle = cfgLine[1];
}
//configure.editor.window^636^458
if (cfgLine[0] == "configure.editor.window")
{
this.EditorWidth = int.Parse(cfgLine[1]);
this.EditorHeight = int.Parse(cfgLine[2]);
}
if (cfgLine[0] == "add.tab")
{
// add.tab^TabTitle^canselect yes or no
//cfgLine[1];
TabPage tPage = new TabPage(cfgLine[1]);
this.EditorTabs.Add(cfgLine[1], tPage);
}
if (cfgLine[0] == "add.button")
{
//# add.button^id^tabpage^width^height^top^left^value^function
//# function can be - savetodb , or closeeditor
//add.button^close^General^25^20^100^100^Close^closeeditor
TabPage tPage = (TabPage)this.EditorTabs[cfgLine[2]];
if (tPage == null)
return;
Button cmdButton = new Button();
cmdButton.Width = int.Parse(cfgLine[3]);
cmdButton.Height = int.Parse(cfgLine[4]);
cmdButton.Name = cfgLine[1];
tPage.Controls.Add(cmdButton);
cmdButton.Top = int.Parse(cfgLine[5]);
cmdButton.Left = int.Parse(cfgLine[6]);
cmdButton.Text = cfgLine[7];
cmdButton.Tag = cfgLine[8];
cmdButton.Show();
cmdButton.Click += new EventHandler(cmdButton_Click);
}
if (cfgLine[0] == "add.label")
{
// add.label^id^tabpage^width^height^top^left^value
TabPage tPage = (TabPage)this.EditorTabs[cfgLine[2]];
if (tPage == null)
return;
Label lblNew = new Label();
lblNew.Width = int.Parse(cfgLine[3]);
lblNew.Height = int.Parse(cfgLine[4]);
lblNew.Name = cfgLine[1];
tPage.Controls.Add(lblNew);
lblNew.Top = int.Parse(cfgLine[5]);
lblNew.Left = int.Parse(cfgLine[6]);
lblNew.Text = cfgLine[7];
lblNew.Show();
}
if (cfgLine[0] == "add.input.control")
//.........这里部分代码省略.........
示例14: AddWord
public DialogResult AddWord()
{
Form wordForm = new Form();
wordForm.StartPosition = FormStartPosition.CenterScreen;
wordForm.FormBorderStyle = FormBorderStyle.Fixed3D;
wordForm.Size = new Size(250, 180);
wordForm.MinimizeBox = false;
wordForm.MaximizeBox = false;
wordForm.Text = "Новое слово";
Label wordLabel = new Label();
wordLabel.Location = new Point(10, 10);
wordLabel.AutoSize = false;
wordLabel.Size = new Size(230, 25);
wordLabel.Font = new Font("Times New Roman", 12, FontStyle.Bold);
wordLabel.Text = "Слово: ";
Label translateLabel = new Label();
translateLabel.Location = new Point(10, 60);
translateLabel.AutoSize = false;
translateLabel.Size = new Size(230, 25);
translateLabel.Font = new Font("Times New Roman", 12, FontStyle.Bold);
translateLabel.Text = "Перевод: ";
wordTextBox = new TextBox();
wordTextBox.Location = new Point(10, 35);
wordTextBox.Size = new Size(215, 25);
wordTextBox.Text = null;
translateTextBox = new TextBox();
translateTextBox.Location = new Point(10, 85);
translateTextBox.Size = new Size(215, 25);
translateTextBox.Text = null;
Button okButton = new Button();
okButton.Location = new Point(80, 115);
okButton.Size = new Size(70, 25);
okButton.DialogResult = DialogResult.OK;
okButton.Text = "OK";
Button cancelButton = new Button();
cancelButton.Location = new Point(155, 115);
cancelButton.Size = new Size(70, 25);
cancelButton.DialogResult = DialogResult.Cancel;
cancelButton.Text = "Cancel";
wordForm.Controls.Add(wordLabel);
wordForm.Controls.Add(translateLabel);
wordForm.Controls.Add(wordTextBox);
wordForm.Controls.Add(translateTextBox);
wordForm.Controls.Add(okButton);
wordForm.Controls.Add(cancelButton);
wordLabel.Show();
translateLabel.Show();
wordTextBox.Show();
translateTextBox.Show();
okButton.Show();
cancelButton.Show();
wordForm.ShowDialog();
return wordForm.DialogResult;
}
示例15: BeginEditing
private void BeginEditing()
{
EndEditing(true);
_editing = true;
if (_editingIndex != -1)
{
_txtInclude = new TextBox();
_txtInclude.Leave += txtInclude_Leave;
_txtInclude.Text = includeList.Items[includeList.SelectedIndex].ToString();
_editingIncludeDir = _txtInclude.Text;
includeList.SelectionMode = SelectionMode.One;
Rectangle rect = includeList.GetItemRectangle(includeList.SelectedIndex);
_txtInclude.Location = new Point(includeList.Location.X + 2,
includeList.Location.Y + rect.Y);
_txtInclude.Width = includeList.Width - 50;
_txtInclude.Parent = includeList;
_txtInclude.KeyUp += new KeyEventHandler(txtInclude_KeyUp);
groupBox1.Controls.Add(_txtInclude);
_btnSelectInclude = new Button();
_btnSelectInclude.Text = "...";
_btnSelectInclude.Location = new Point(includeList.Location.X + _txtInclude.Width,
includeList.Location.Y + rect.Y);
_btnSelectInclude.Width = 50;
_btnSelectInclude.Height = _txtInclude.Height;
_btnSelectInclude.Click += new EventHandler(btnSelectInclude_Clicked);
groupBox1.Controls.Add(_btnSelectInclude);
_txtInclude.Show();
_txtInclude.BringToFront();
_txtInclude.Focus();
_btnSelectInclude.Show();
_btnSelectInclude.BringToFront();
}
}