本文整理汇总了C#中System.Windows.Forms.ComboBox.Show方法的典型用法代码示例。如果您正苦于以下问题:C# ComboBox.Show方法的具体用法?C# ComboBox.Show怎么用?C# ComboBox.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ComboBox
的用法示例。
在下文中一共展示了ComboBox.Show方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _add_standart_combo_box
protected virtual Control _add_standart_combo_box(Panel Panel,int ui,int SelectedIndex,object[] Items,Font font,int HorizontalShift=1,int VerticalShift=5)
{
ComboBox Result = new ComboBox();
if(font==null)font=new Font(FontFamily.GenericSansSerif,12.25F);
Result.Size = new Size(Panel.Width - HorizontalShift*2-15, Result.Height);
Result.Font = font;
Result.Items.AddRange(Items);
Result.SelectedIndex = SelectedIndex;
Result.SelectedValueChanged += (sender, e) => { _fcm_on_fcm_data_changed(Result.SelectedIndex, ui, Result); };
Control lcontrol =Panel.Controls.Count>0? Panel.Controls[Panel.Controls.Count - 1]:null;
Point lloc=lcontrol!=null? lcontrol.Location:new Point(HorizontalShift,VerticalShift);
if(lcontrol!=null)lloc=new Point(HorizontalShift,lloc.Y+VerticalShift+lcontrol.Height);
Result.Location = lloc;
Panel.Controls.Add(Result);
Result.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
Result.Show();
return Result;
}
示例2: AgentGUI
public AgentGUI( string caption )
{
m_Id = ++m_IdCounter;
RadioGroupUpdater[] tmpOld = m_UpdaterList;
m_UpdaterList = new RadioGroupUpdater[m_Id];
if ( tmpOld != null )
for ( int i = 0; i < tmpOld.Length; i++ )
m_UpdaterList[i] = tmpOld[i];
m_UpdaterList[m_Id-1] = new RadioGroupUpdater( SyncPlayerSelectors );
this.Text = caption;
this.Width = 430;
this.Height = 340;
this.MaximizeBox = false;
this.FormBorderStyle = FormBorderStyle.FixedSingle;
m_GroupBoxPlayer = new GroupBox();
m_GroupBoxPlayer.Text = "Play as";
m_GroupBoxPlayer.Width = 100;
m_GroupBoxPlayer.Height = 150;
m_GroupBoxPlayer.Left = 10;
m_GroupBoxPlayer.Top = 25;
m_GroupBoxPlayer.Show();
this.Controls.Add( m_GroupBoxPlayer );
m_PlayerLight = new RadioButton();
m_PlayerLight.Text = "Light";
m_PlayerLight.Width = 50;
m_PlayerLight.Left = 25;
m_PlayerLight.Top = 50;
m_PlayerLight.Checked = true;
m_PlayerLight.CheckedChanged += new EventHandler( m_PlayerSelect_Click );
m_PlayerLight.Show();
m_GroupBoxPlayer.Controls.Add( m_PlayerLight );
m_PlayerDark = new RadioButton();
m_PlayerDark.Text = "Dark";
m_PlayerDark.Width = 50;
m_PlayerDark.Left = 25;
m_PlayerDark.Top = 80;
m_PlayerDark.CheckedChanged += new EventHandler( m_PlayerSelect_Click );
m_PlayerDark.Show();
m_GroupBoxPlayer.Controls.Add( m_PlayerDark );
m_PlayerNone = new RadioButton();
m_PlayerNone.Text = "None";
m_PlayerNone.Width = 50;
m_PlayerNone.Left = 25;
m_PlayerNone.Top = 20;
m_PlayerNone.CheckedChanged += new EventHandler( m_PlayerSelect_Click );
m_PlayerNone.Show();
m_GroupBoxPlayer.Controls.Add( m_PlayerNone );
m_PlayerBoth = new RadioButton();
m_PlayerBoth.Text = "Both";
m_PlayerBoth.Width = 50;
m_PlayerBoth.Left = 25;
m_PlayerBoth.Top = 110;
m_PlayerBoth.CheckedChanged += new EventHandler( m_PlayerSelect_Click );
m_PlayerBoth.Show();
m_GroupBoxPlayer.Controls.Add( m_PlayerBoth );
m_EvaluatorLabel = new Label();
m_EvaluatorLabel.Text = "Evaluator";
m_EvaluatorLabel.Left = 10;
m_EvaluatorLabel.Top = 190;
m_EvaluatorLabel.AutoSize = true;
m_EvaluatorLabel.Show();
this.Controls.Add( m_EvaluatorLabel );
m_PluginSelector = new ComboBox();
m_PluginSelector.DropDownStyle = ComboBoxStyle.DropDownList;
m_PluginSelector.Left = 10;
m_PluginSelector.Top = 210;
m_PluginSelector.Width = 100;
m_PluginSelector.Items.Add( "None" );
m_PluginSelector.SelectedIndex = 0;
m_PluginSelector.Show();
this.Controls.Add( m_PluginSelector );
m_LearnPanel = new Panel();
m_LearnPanel.BorderStyle = BorderStyle.None;
m_LearnPanel.Left = 5;
m_LearnPanel.Top = 240;
m_LearnPanel.Width = 100;
m_LearnPanel.Height = 25;
m_LearnPanel.Show();
this.Controls.Add( m_LearnPanel );
m_Learn = new CheckBox();
m_Learn.Text = "Learn";
m_Learn.Left = 5;
m_Learn.Top = 0;
m_Learn.Checked = false;
m_Learn.CheckedChanged += new EventHandler( m_Learn_CheckedChanged );
m_Learn.Show();
m_LearnPanel.Controls.Add( m_Learn );
if (m_Id == 1)
m_Learn.Checked = true;
//.........这里部分代码省略.........
示例3: cboLogic_SelectedIndexChanged
private void cboLogic_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.cboLogic.Text == "BETWEEN")
{
/* make an exact copy of the current input control and place it next to the other */
if (this.CurrentInputObject.GetType() == typeof(TextBox))
{
TextBox tBox1 = (TextBox)this.CurrentInputObject;
TextBox tBox2 = new TextBox();
tBox1.Width = (this.pnlCriteriaInput.Width - 10) / 2;
tBox2.Width = (this.pnlCriteriaInput.Width - 10) / 2;
tBox2.Left = tBox1.Left + tBox1.Width + 5;
this.CurrentInputObject2 = tBox2;
this.pnlCriteriaInput.Controls.Add(tBox2);
tBox2.Show();
}
else if (this.CurrentInputObject.GetType() == typeof(ComboBox))
{
ComboBox cBox1 = (ComboBox)this.CurrentInputObject;
ComboBox cBox2 = new ComboBox();
cBox1.Width = (this.pnlCriteriaInput.Width - 10) / 2;
cBox2.Width = (this.pnlCriteriaInput.Width - 10) / 2;
cBox2.Left = cBox2.Left + cBox2.Width + 5;
cBox2.DropDownStyle = cBox1.DropDownStyle;
this.CurrentInputObject2 = cBox2;
foreach (String cboItem in cBox1.Items)
{
cBox2.Items.Add(cboItem);
}
cBox2.SelectedIndex = cBox1.SelectedIndex;
this.pnlCriteriaInput.Controls.Add(cBox2);
cBox2.Show();
}
}
else
{
/* not between */
if (this.CurrentInputObject2 != null)
{
/* this implies that the inputcriteria was setup for between/range, but now does not need to be */
this.pnlCriteriaInput.Controls.Clear();
// now call the initial combobox selector setup
this.CurrentInputObject2 = null;
this.cboCriteriaID_SelectedIndexChanged(this, new EventArgs());
}
}
}
示例4: cboCriteriaID_SelectedIndexChanged
private void cboCriteriaID_SelectedIndexChanged(object sender, EventArgs e)
{
this.lblID.Text = cboCriteriaID.Text;
CriteriaRequester cReq = (CriteriaRequester)this.CriteriaList[this.cboCriteriaID.Text];
this.pnlCriteriaInput.Controls.Clear();
if (cReq.CritType == CriteriaRequester.CriteriaType.Text)
{
TextBox txtSearchCriteriaInput = new TextBox();
this.pnlCriteriaInput.Controls.Add(txtSearchCriteriaInput);
txtSearchCriteriaInput.Width = this.pnlCriteriaInput.Width - 10;
txtSearchCriteriaInput.Show();
this.CurrentInputObject = txtSearchCriteriaInput;
}
else if (cReq.CritType == CriteriaRequester.CriteriaType.DropDown)
{
ComboBox cBox = new ComboBox();
this.pnlCriteriaInput.Controls.Add(cBox);
cBox.Width = this.pnlCriteriaInput.Width - 10;
cBox.DropDownStyle = ComboBoxStyle.DropDownList;
foreach (String ID in cReq.DropDownContent)
{
cBox.Items.Add(ID);
}
cBox.Show();
this.CurrentInputObject = cBox;
}
this.cboLogic_SelectedIndexChanged(this, new EventArgs());
}
示例5: dmUpDowStringCount_SelectedItemChanged
private void dmUpDowStringCount_SelectedItemChanged(object sender, EventArgs e)
{
SavePrevTuning();
ClearOldComboBoxes();
int stringCount = 0;
int yLocationIncrement = 30;
System.Drawing.Size comboBoxSize = new System.Drawing.Size(121, 24);
System.Drawing.Point startLocation = new System.Drawing.Point(29, 69);
string stringCountStr = dmUpDowStringCount.SelectedItem as string;
if (Int32.TryParse(stringCountStr, out stringCount))
{
for (int i = 0; i < stringCount; ++i)
{
ComboBox temBox = new ComboBox();
temBox.FormattingEnabled = true;
temBox.Location = startLocation;
temBox.Name = "String_" + i;
temBox.Size = comboBoxSize;
temBox.TabIndex = i + 1;
foreach(string note in G_Rules.Notes)
{
temBox.Items.Add(note);
}
temBox.SelectedIndex = 1;
Controls.Add(temBox);
temBox.Show();
_Strings.Add(temBox);
startLocation.Y += yLocationIncrement;
}
FillInStrings();
SetPrevTuning();
}
}
示例6: MainWindow
public MainWindow()
{
this.Size = new System.Drawing.Size(500, 380);
this.Text = "Untitled Application";
Application.EnableVisualStyles();
selectFolderBtn = new Button();
selectFolderBtn.Text = "Add folder with images...";
selectFolderBtn.Click += HandleSelectFolderBtnClick;
selectFolderBtn.Location = new System.Drawing.Point(5, 210);
selectFolderBtn.Size = new System.Drawing.Size(200, 30);
selectFolderBtn.Show();
this.Controls.Add(selectFolderBtn);
selectImageBtn = new Button();
selectImageBtn.Text = "Add single images...";
selectImageBtn.Click += HandleSelectImageBtnClick;
selectImageBtn.Location = new System.Drawing.Point(5, 245);
selectImageBtn.Size = new System.Drawing.Size(200, 30);
selectImageBtn.Show();
this.Controls.Add(selectImageBtn);
deleteSelectedBtn = new Button();
deleteSelectedBtn.Text = "Remove selected image from list";
deleteSelectedBtn.Click += HandleDeleteSelectedBtnClick;
deleteSelectedBtn.Location = new System.Drawing.Point(5, 280);
deleteSelectedBtn.Size = new System.Drawing.Size(200, 30);
deleteSelectedBtn.Show();
this.Controls.Add(deleteSelectedBtn);
clearListBtn = new Button();
clearListBtn.Text = "Clear list";
clearListBtn.Click += HandleClearListBtnClick;
clearListBtn.Location = new System.Drawing.Point(5, 315);
clearListBtn.Size = new System.Drawing.Size(200, 30);
clearListBtn.Show();
this.Controls.Add(clearListBtn);
fileSelectList = new CheckedListBox();
fileSelectList.Location = new System.Drawing.Point(5, 5);
fileSelectList.Size = new System.Drawing.Size(200, 200);
fileSelectList.Show();
this.Controls.Add(fileSelectList);
startPresentationBtn = new Button();
startPresentationBtn.Text = "Start Presentation";
startPresentationBtn.Location = new System.Drawing.Point(250, 210);
startPresentationBtn.Size = new System.Drawing.Size(200, 30);
startPresentationBtn.Click += HandleStartPresentationBtnClick;
startPresentationBtn.Show();
this.Controls.Add(startPresentationBtn);
Label numOfSecondsLbl = new Label();
numOfSecondsLbl.Text = "Delay in seconds:";
numOfSecondsLbl.Location = new System.Drawing.Point(250, 45);
numOfSecondsLbl.Size = new System.Drawing.Size(100, 30);
numOfSecondsLbl.Show();
this.Controls.Add(numOfSecondsLbl);
Label numOfTilesLbl = new Label();
numOfTilesLbl.Text = "Number of tiles:";
numOfTilesLbl.Location = new System.Drawing.Point(250, 85);
numOfTilesLbl.Size = new System.Drawing.Size(100, 30);
numOfTilesLbl.Show();
this.Controls.Add(numOfTilesLbl);
numOfTilesBox = new ComboBox();
numOfTilesBox.DropDownStyle = ComboBoxStyle.DropDownList;
for (int i = 1; i < 21; i++)
{
numOfTilesBox.Items.Add(i*i);
}
numOfTilesBox.SelectedItem = 16;
numOfTilesBox.Location = new System.Drawing.Point(380, 85);
numOfTilesBox.Size = new System.Drawing.Size(100, 30);
numOfTilesBox.Show();
this.Controls.Add(numOfTilesBox);
secondsBox = new NumericUpDown();
secondsBox.Maximum = 60;
secondsBox.Minimum = 1;
secondsBox.Value = 5;
secondsBox.Location = new System.Drawing.Point(380, 45);
secondsBox.Size = new System.Drawing.Size(100, 30);
secondsBox.Show();
this.Controls.Add(secondsBox);
}