本文整理汇总了C#中System.Windows.Forms.ComboBox类的典型用法代码示例。如果您正苦于以下问题:C# ComboBox类的具体用法?C# ComboBox怎么用?C# ComboBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComboBox类属于System.Windows.Forms命名空间,在下文中一共展示了ComboBox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CardInfoBindComboBox
/// <summary>
/// 绑定标识卡号信息
/// </summary>
/// <param name="cmb"></param>
/// <param name="deptID"></param>
public void CardInfoBindComboBox(ComboBox cmb,string deptID)
{
DataSet ds = null;
try
{
ds = HMDAL.GetEmpInfo(deptID);
if (ds != null && ds.Tables.Count > 0)
{
DataTable dt = ds.Tables[0];
DataRow dr = dt.NewRow();
dr["CodeSenderAddress"] = "所有";
dr["empName"] = "0";
dt.Rows.InsertAt(dr, 0);
dt.AcceptChanges();
cmb.DataSource = dt;
cmb.DisplayMember = "CodeSenderAddress";
cmb.ValueMember = "empName";
}
else
{
cmb.Items.Add("所有");
}
}
catch
{
cmb.Items.Add("所有");
}
}
开发者ID:ZoeCheck,项目名称:128_5.6_2010,代码行数:34,代码来源:HolidayManageBLL.cs
示例2: InsertPInvokeSignaturesForm
public InsertPInvokeSignaturesForm()
{
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("PInvokeAddIn.Resources.InsertPInvokeSignaturesForm.xfrm"));
signatureRichTextBox = ((RichTextBox)ControlDictionary["SignatureRichTextBox"]);
// Hook up events.
closeButton = ((Button)ControlDictionary["CloseButton"]);
closeButton.Click += new EventHandler(CloseButtonClick);
insertButton = ((Button)ControlDictionary["InsertButton"]);
insertButton.Enabled = false;
insertButton.Click += new EventHandler(InsertButtonClick);
findButton = ((Button)ControlDictionary["FindButton"]);
findButton.Click += new EventHandler(FindButtonClick);
functionNameComboBox = ((ComboBox)ControlDictionary["FunctionNameComboBox"]);
functionNameComboBox.AutoCompleteMode = AutoCompleteMode.Suggest;
functionNameComboBox.AutoCompleteSource = AutoCompleteSource.ListItems;
moduleNameComboBox = ((ComboBox)ControlDictionary["ModuleNameComboBox"]);
moduleNameComboBox.AutoCompleteMode = AutoCompleteMode.Suggest;
moduleNameComboBox.AutoCompleteSource = AutoCompleteSource.ListItems;
moreInfoLinkLabel = ((LinkLabel)ControlDictionary["MoreInfoLinkLabel"]);
moreInfoLinkLabel.LinkClicked += new LinkLabelLinkClickedEventHandler(MoreInfoLinkClicked);
languageComboBox = ((ComboBox)ControlDictionary["LanguageComboBox"]);
languageComboBox.SelectedIndexChanged += new EventHandler(LanguageComboBoxSelectedIndexChanged);
SetupLanguages();
SetupFunctionNames();
SetupModuleNames();
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:35,代码来源:InsertPInvokeSignaturesForm.cs
示例3: GetAppointmentIDsAndTests
private void GetAppointmentIDsAndTests()
{
this.Clear();
DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();
cmb.HeaderText = "Select Test";
ComboBox cbTests = new ComboBox();
foreach (LabTest test in testList)
{
cmb.Items.Add(test.TestType);
}
dgvAddTest.Columns.Add(cmb);
//cbAppointmentID.SelectedIndexChanged -= cbAppointmentID_SelectedIndexChanged;
//cbAppointmentID.DataSource = null;
//cbAppointmentID.Items.Clear();
//cbAppointmentID.SelectedIndexChanged += cbAppointmentID_SelectedIndexChanged;
//appointmentsList = AppointmentController.GetAppointmentsWithoutDiagnosis();
//cbAppointmentID.DataSource = appointmentsList;
//cbAppointmentID.DisplayMember = "AppointmentID";
//cbAppointmentID.ValueMember = "AppointmentID";
//cbTest.SelectedIndexChanged -= cbTest_SelectedIndexChanged;
//cbTest.DataSource = null;
//cbTest.Items.Clear();
//cbTest.SelectedIndexChanged += cbTest_SelectedIndexChanged;
//testList = LabTestController.GetAllLabTests();
//cbTest.DataSource = testList;
//cbTest.DisplayMember = "TestType";
//cbTest.ValueMember = "TestId";
}
开发者ID:mwilian,项目名称:healthcaresystem,代码行数:35,代码来源:frmAddTest.cs
示例4: InitDropdownTypes
public static void InitDropdownTypes(ComboBox cbo, ModuleDefinition module)
{
using (new SimpleWaitCursor())
{
object savedItem = cbo.SelectedItem;
cbo.Items.Clear();
cbo.Sorted = true;
if (module != null)
{
foreach (TypeDefinition td in module.AllTypes)
{
if (td.FullName.StartsWith("<")) continue;
cbo.Items.Add(td);
}
}
Type[] systemTypes = typeof(System.Int32).Module.GetTypes();
foreach (Type systemType in systemTypes)
{
if (systemType.FullName.StartsWith("<")) continue;
cbo.Items.Add(systemType);
}
if (savedItem != null)
{
if (!cbo.Items.Contains(savedItem))
{
cbo.Items.Add(savedItem);
}
cbo.SelectedItem = savedItem;
}
}
}
开发者ID:manojdjoshi,项目名称:simple-assembly-exploror,代码行数:35,代码来源:ClassEditHelper.cs
示例5: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.cboSourceLayer = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// cboSourceLayer
//
this.cboSourceLayer.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboSourceLayer.DropDownWidth = 260;
this.cboSourceLayer.Items.AddRange(new object[] {
"<Business Features Source Layer>"});
this.cboSourceLayer.Location = new System.Drawing.Point(16, 24);
this.cboSourceLayer.Name = "cboSourceLayer";
this.cboSourceLayer.Size = new System.Drawing.Size(216, 21);
this.cboSourceLayer.TabIndex = 0;
//this.cboSourceLayer.SelectedIndexChanged += new System.EventHandler(this.cboSourceLayer_SelectedIndexChanged);
//
// SourceLayerContainerForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(312, 77);
this.Controls.Add(this.cboSourceLayer);
this.Name = "SourceLayerContainerForm";
this.Text = "This is just a control container form";
this.ResumeLayout(false);
}
开发者ID:EAWCS1,项目名称:SUITT,代码行数:30,代码来源:SourceLayerContainerForm.cs
示例6: GetWinFormsControlAdapter
private static IWinFormsComboBoxAdapter GetWinFormsControlAdapter()
{
var control = new ComboBox();
var winFormsControlAdapter = MockRepository.GenerateStub<IWinFormsComboBoxAdapter>();
winFormsControlAdapter.Stub(adapter => adapter.WrappedControl).Return(control);
return winFormsControlAdapter;
}
开发者ID:Chillisoft,项目名称:habanero.faces,代码行数:7,代码来源:TestComboBoxDefaultMapperStrageyWin.cs
示例7: AbstractCreate
protected override void AbstractCreate(object value, ref int tabIndex)
{
var left = Margin;
var top = Margin;
// ラベルの作成 top+3 は後のテキストボックスとの整合のため
_label = (Label) Create(Panel, new Label(), left, top + 3, -1);
_label.Text = Help;
// label.setBorder(new LineBorder(Color.RED, 2, true)); //Debug 赤枠
left += LabelWidth(_label) + 10; // オフセット移動
// コンボボックスの配置
_comboBox = (ComboBox) Create(Panel, new ComboBox(), left, top, tabIndex++);
_comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
foreach (var s in _list){
_comboBox.Items.Add(s);
var w = TextWidth(s) + 20;
if (w > _comboBox.Width){
_comboBox.Width = w;
}
}
//comboBox.addActionListener(this);
_comboBox.SelectedIndexChanged += Change;//[C#] コントロールの変化をイベント処理する
//comboBox.setSize(width, comboBox.getHeight());
_comboBox.Width = _width;
left += _comboBox.Width; // オフセット移動
//値の設定
AbstractWrite(value);
// パネルのサイズ設定
Panel.Size = new Size(left + Margin, DefaultHeight + Margin);
}
开发者ID:jsakamoto,项目名称:bjd5,代码行数:34,代码来源:CtrlComboBox.cs
示例8: ContestantWrongInfo
public ContestantWrongInfo(List<ContestantListLine> notValidInfo, List<bool[]> notValidInfoColumn)
{
InitializeComponent();
this.notValidInfo = notValidInfo;
this.notValidInfoColumn = notValidInfoColumn;
nameColumn.AspectGetter = delegate(object x) { return ((ContestantListLine)x).FirstName; };
nameColumn.AspectPutter = delegate(object x, object newValue) { ((ContestantListLine)x).FirstName = newValue.ToString(); };
lastnameColumn.AspectGetter = delegate(object x) { return ((ContestantListLine)x).LastName; };
lastnameColumn.AspectPutter = delegate(object x, object newValue) { ((ContestantListLine)x).LastName = newValue.ToString(); };
seuraColumn.AspectGetter = delegate(object x) { return ((ContestantListLine)x).LastName; };
seuraColumn.AspectPutter = delegate(object x, object newValue) { ((ContestantListLine)x).LastName = newValue.ToString(); };
//COMPOBOX TEST
ComboBox comboBox1 = new ComboBox();
comboBox1.Name = "comboBox1";
comboBox1.BackColor = System.Drawing.Color.Orange;
comboBox1.Items.Add("Mahesh Chand");
comboBox1.Items.Add("Mike Gold");
objectListView1.SetObjects(notValidInfo);
}
开发者ID:Cubio,项目名称:Hauli,代码行数:25,代码来源:ContestantWrongInfo.cs
示例9: olvCellEditStarting
private void olvCellEditStarting(object sender, CellEditEventArgs e)
{
Console.WriteLine("LKLJKLJKL");
List<String> countries = new List<String> {"testi", "joku", "Hiiri"};
ComboBox cboCombo = new ComboBox();
cboCombo.Bounds = e.CellBounds;
cboCombo.Left = e.CellBounds.Left + 1;
cboCombo.Width = e.CellBounds.Width - 1;
cboCombo.DropDownStyle = ComboBoxStyle.DropDownList;
cboCombo.DisplayMember = "Display";
cboCombo.ValueMember = "ID";
cboCombo.DataSource = countries;
cboCombo.AutoCompleteSource = AutoCompleteSource.ListItems;
cboCombo.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
cboCombo.Update();
//int intComboEditorSelectedValue = countries.Find(item => item.Display == (string)(e.Value)).ID; e.Control = cboCombo; cboCombo.SelectedValue = intComboEditorSelectedValue; //fails silently
/*
if (e.Column.Text != "Seura")
return;
ComboBox cb = new ComboBox();
cb.Bounds = e.CellBounds;
cb.Font = ((ObjectListView)sender).Font;
cb.DropDownStyle = ComboBoxStyle.DropDownList;
cb.Items.AddRange(new String[] { "Pay to eat out", "Suggest take-away", "Passable", "Seek dinner invitation", "Hire as chef" });
cb.SelectedIndex = ((int)e.Value) / 10;
//cb.SelectedIndexChanged += new EventHandler(cb_SelectedIndexChanged);
cb.Tag = e.RowObject; // remember which person we are editing
e.Control = cb;
*
* */
}
开发者ID:Cubio,项目名称:Hauli,代码行数:35,代码来源:ContestantWrongInfo.cs
示例10: CanExtend_ComboBox_False
public void CanExtend_ComboBox_False()
{
using (ComboBox comboBox = new ComboBox())
{
Assert.IsFalse(((IExtenderProvider) _prompt).CanExtend(comboBox));
}
}
开发者ID:JohnThomson,项目名称:libpalaso,代码行数:7,代码来源:PromptTests.cs
示例11: TgcEnumModifier
public TgcEnumModifier(string varName, Type enumType, object defaultValue)
: base(varName)
{
this.enumType = enumType;
this.selectValue = defaultValue;
//Buscar indice del defaultValue dentro del enum
string[] enumNames = Enum.GetNames(enumType);
string currentName = Enum.GetName(enumType, defaultValue);
int selectedIndex = -1;
for (int i = 0; i < enumNames.Length; i++)
{
if (currentName.Equals(enumNames[i]))
{
selectedIndex = i;
break;
}
}
comboBox = new ComboBox();
comboBox.Margin = new Padding(0);
comboBox.Size = new System.Drawing.Size(100, 20);
comboBox.Items.AddRange(enumNames);
comboBox.SelectedIndex = selectedIndex;
comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
comboBox.SelectionChangeCommitted += new EventHandler(comboBox_SelectionChangeCommitted);
contentPanel.Controls.Add(comboBox);
}
开发者ID:JesusHerrera,项目名称:tgc-viewer,代码行数:29,代码来源:TgcEnumModifier.cs
示例12: AddNewComboBox
public ComboBox AddNewComboBox()
{
ComboBox newComboBox = new
ComboBox();
//add to the collection list
this.List.Add(newComboBox);
//add to the overall form controls
Hatchu.Controls.Add(newComboBox);
newComboBox.Top = 22 + levelCount * 170;
newComboBox.Width = 95;
newComboBox.Left = miniCount * (newComboBox.Width + 10) + 80;
newComboBox.Tag = this.Count;
newComboBox.Text = "";
newComboBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
newComboBox.AutoCompleteSource = AutoCompleteSource.ListItems;
newComboBox.KeyDown += new System.Windows.Forms.KeyEventHandler(EnterHandler);
AddDanceTypes(newComboBox);
miniCount++;
if (Count % 6 == 0)
{
miniCount = 0;
levelCount++;
}
return newComboBox;
}
开发者ID:Harmonickey,项目名称:AlexCSPortfolio,代码行数:32,代码来源:DanceTypeBoxArray.cs
示例13: TextInputDialog
public TextInputDialog(string []query,object []initialItem, object []comboBoxItems)
{
InitializeComponent();
Control[] controls = new Control[query.Length];
for (int i = 0; i < query.Length; i++ )
{
if (comboBoxItems == null || comboBoxItems.Length <= i || comboBoxItems[i] == null)
{
controls[i] = new TextBox();
if (initialItem != null && initialItem[i] != null)
controls[i].Text = "" + initialItem[i];
if (i == query.Length - 1)
(controls[i] as TextBox).Multiline = true;
}
else
{
controls[i] = new ComboBox();
(controls[i] as ComboBox).DataSource = comboBoxItems.Clone();
if (initialItem != null && initialItem[i] != null)
(controls[i] as ComboBox).SelectedItem = initialItem[i];
}
}
AddAllControls(query, controls);
}
开发者ID:adrianj,项目名称:AdriansLib,代码行数:27,代码来源:TextInputDialog.cs
示例14: SetupComboBox
private void SetupComboBox(System.Type type, ComboBox comboBox)
{
Array types = Enum.GetValues(type);
for (int intI = 0; intI < types.Length; intI++)
comboBox.Items.Add(types.GetValue(intI));
comboBox.SelectedIndex = 0;
}
开发者ID:CuneytKukrer,项目名称:TestProject,代码行数:7,代码来源:MainForm.cs
示例15: InitializeComponent
private void InitializeComponent()
{
this.comboBoxApplication = new System.Windows.Forms.ComboBox();
this.buttonOK = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// comboBoxApplication
//
this.comboBoxApplication.Location = new System.Drawing.Point(8, 8);
this.comboBoxApplication.Name = "comboBoxApplication";
this.comboBoxApplication.Size = new System.Drawing.Size(280, 21);
this.comboBoxApplication.TabIndex = 0;
//
// buttonOK
//
this.buttonOK.Location = new System.Drawing.Point(296, 8);
this.buttonOK.Name = "buttonOK";
this.buttonOK.TabIndex = 1;
this.buttonOK.Text = "OK";
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// FSelectApplication
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(376, 37);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.comboBoxApplication);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.Name = "FSelectApplication";
this.Text = "Select Application";
this.Text = Strings.SelectApplication;
this.Load += new System.EventHandler(this.FSelectApplication_Load);
this.ResumeLayout(false);
}
开发者ID:psyCHOder,项目名称:conferencexp,代码行数:35,代码来源:FSelectApplication.cs
示例16: InvoiceNoComboFillOfSalesReturnRegister
/// <summary>
/// Function for InvoiceNo ComboFill Of SalesReturn Register based on parmeter
/// </summary>
/// <param name="cmbInvoiceNo"></param>
/// <param name="isAll"></param>
public void InvoiceNoComboFillOfSalesReturnRegister(ComboBox cmbInvoiceNo, bool isAll)
{
DataTable dtblInvoiceNo = new DataTable();
try
{
if (sqlcon.State == ConnectionState.Closed)
{
sqlcon.Open();
}
SqlDataAdapter sqlda = new SqlDataAdapter("AgainstInvoiceNoComboFillInSalesReturnRegister", sqlcon);
sqlda.SelectCommand.CommandType = CommandType.StoredProcedure;
sqlda.Fill(dtblInvoiceNo);
if (isAll)
{
DataRow dr = dtblInvoiceNo.NewRow();
dr["invoiceNo"] = "All";
dr["salesMasterId"] = 0;
dtblInvoiceNo.Rows.InsertAt(dr, 0);
}
cmbInvoiceNo.DataSource = dtblInvoiceNo;
cmbInvoiceNo.DisplayMember = "invoiceNo";
cmbInvoiceNo.ValueMember = "salesMasterId";
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
sqlcon.Close();
}
}
开发者ID:JaseelAM,项目名称:OpenMiracle-Three-Tier,代码行数:37,代码来源:SalesReturnMasterSP.cs
示例17: LoadDataToCombobox
//Methods - Helper
private bool LoadDataToCombobox(ComboBox combobox, ref SerialPort _GLOBAL_PORT, string _GLOBAL_PORT_NAME)
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
try
{
//Create items for Combobox
foreach (var port in SerialPort.GetPortNames())
{
dictionary.Add(port, port);
}
combobox.DataSource = new BindingSource(dictionary, null);
combobox.DisplayMember = "Name";
combobox.ValueMember = "Value";
combobox.SelectedIndex = -1;
//Query Ports (if they have in xml database)
PortSetting portSetting = service.SelectByName(_GLOBAL_PORT_NAME);
if (portSetting != null) { combobox.SelectedValue = portSetting.Value.ToString(); }
//Open Ports
if (_GLOBAL_PORT.IsOpen) { _GLOBAL_PORT.Close(); }
if (combobox.SelectedIndex != -1 && !_GLOBAL_PORT.PortName.Equals(combobox.SelectedValue.ToString()))
{
_GLOBAL_PORT.PortName = combobox.SelectedValue.ToString();
}
_GLOBAL_PORT.Open();
}
catch
{
return false;
}
return true;
}
开发者ID:haltt051093,项目名称:IMS-datacenter,代码行数:34,代码来源:PortSettingForm.cs
示例18: AddCrTypeToCmb
private void AddCrTypeToCmb(ComboBox Cmb, uint CrType)
{
if (CrType == 0)
return;
Cmb.Items.Add(GetCrTypeDefineByPid((int)CrType) + " [" + CrType + "]");
}
开发者ID:SnakeSolidNL,项目名称:tools,代码行数:7,代码来源:frmEncounterGroupEditor.cs
示例19: populateAdaptersList
public static void populateAdaptersList(ComboBox networkAdaptersList)
{
networkAdaptersList.DataSource = NetInterfaces.interfaces;
networkAdaptersList.DisplayMember = "name";
networkAdaptersList.ValueMember = "ID";
networkAdaptersList.SelectedIndex = NetInterfaces.InterfaceIndexWithID(Properties.Settings.Default.TrackedAdapter);
}
开发者ID:hayfield,项目名称:Bandwidth-Monitor,代码行数:7,代码来源:Program.cs
示例20: CGFontCombo
/// <summary>
/// Creates a new instance of the CGFontCombo class.
/// </summary>
public CGFontCombo()
{
// Required by the designer.
InitializeComponent();
// Create the combobox.
m_comboBox = new ComboBox();
m_comboBox.Dock = DockStyle.Fill;
m_comboBox.DrawMode = DrawMode.OwnerDrawFixed;
m_comboBox.BackColor = SystemColors.Window;
m_comboBox.ForeColor = SystemColors.WindowText;
m_comboBox.DisplayMember = "Name";
m_comboBox.DrawItem += new DrawItemEventHandler(
m_comboBox_DrawItem
);
m_comboBox.SelectedIndexChanged += new EventHandler(
m_comboBox_SelectedIndexChanged
);
m_comboBox.FontChanged += new EventHandler(
m_comboBox_FontChanged
);
Controls.Add(m_comboBox);
// Fixup the styles.
SetStyle(ControlStyles.StandardClick, false);
SetStyle(ControlStyles.Selectable, false);
SetStyle(ControlStyles.UserPaint, false);
SetStyle(ControlStyles.ResizeRedraw, true);
SetStyle(ControlStyles.SupportsTransparentBackColor, false);
}
开发者ID:soulslicer,项目名称:ToDoPlusPlus,代码行数:33,代码来源:FontControl.cs
注:本文中的System.Windows.Forms.ComboBox类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论