当前位置: 首页>>代码示例>>C#>>正文


C# ComboBox.Invoke方法代码示例

本文整理汇总了C#中System.Windows.Forms.ComboBox.Invoke方法的典型用法代码示例。如果您正苦于以下问题:C# ComboBox.Invoke方法的具体用法?C# ComboBox.Invoke怎么用?C# ComboBox.Invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.ComboBox的用法示例。


在下文中一共展示了ComboBox.Invoke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InvokeComboxBoxSelectedIndex

 /// <summary>
 /// Invoke方式设置ComboBox控件的SelectedIndex属性
 /// </summary>
 public static void InvokeComboxBoxSelectedIndex(ComboBox combox, int index)
 {
     if (combox.InvokeRequired)
     {
         combox.Invoke(new MethodInvoker(delegate() { InvokeComboxBoxSelectedIndex(combox, index); }));
     }
     else
     {
         combox.SelectedIndex = index;
     }
 }
开发者ID:yienit,项目名称:KST,代码行数:14,代码来源:UIInvokeUtil.cs

示例2: ClearItems

        public static void ClearItems(ComboBox combobox)
        {
            MethodInvoker miClearItems = delegate
            {
                combobox.Items.Clear();
            };

            if (combobox.InvokeRequired)
            {
                combobox.Invoke(miClearItems);
            }
            else
            {
                miClearItems();
            }
        }
开发者ID:NORENBUCH,项目名称:XrmToolBox,代码行数:16,代码来源:ComboboxDelegates.cs

示例3: AddItem

        public static void AddItem(ComboBox combobox, object item)
        {
            MethodInvoker miAddItem = delegate
            {
                combobox.Items.Add(item);
            };

            if (combobox.InvokeRequired)
            {
                combobox.Invoke(miAddItem);
            }
            else
            {
                miAddItem();
            }
        }
开发者ID:NORENBUCH,项目名称:XrmToolBox,代码行数:16,代码来源:ComboboxDelegates.cs

示例4: InsertItem

        public static void InsertItem(ComboBox combobox, int index, object item)
        {
            MethodInvoker miInsertItem = delegate
            {
                combobox.Items.Insert(index, item);
            };

            if (combobox.InvokeRequired)
            {
                combobox.Invoke(miInsertItem);
            }
            else
            {
                miInsertItem();
            }
        }
开发者ID:NORENBUCH,项目名称:XrmToolBox,代码行数:16,代码来源:ComboboxDelegates.cs

示例5: RemoveItemAt

        public static void RemoveItemAt(ComboBox combobox, int index)
        {
            MethodInvoker miRemoveItem = delegate
            {
                combobox.Items.RemoveAt(index);
            };

            if (combobox.InvokeRequired)
            {
                combobox.Invoke(miRemoveItem);
            }
            else
            {
                miRemoveItem();
            }
        }
开发者ID:NORENBUCH,项目名称:XrmToolBox,代码行数:16,代码来源:ComboboxDelegates.cs

示例6: GetItem

        public static object GetItem(ComboBox combobox, int index)
        {
            object item = null;

            MethodInvoker miRemoveItem = delegate
            {
                item = combobox.Items[index];
            };

            if (combobox.InvokeRequired)
            {
                combobox.Invoke(miRemoveItem);
            }
            else
            {
                miRemoveItem();
            }

            return item;
        }
开发者ID:NORENBUCH,项目名称:XrmToolBox,代码行数:20,代码来源:ComboboxDelegates.cs

示例7: GetSelectedItem

        public static object GetSelectedItem(ComboBox combobox)
        {
            object selectedItem = null;

            MethodInvoker miClearItems = delegate
            {
                selectedItem = combobox.SelectedItem;
            };

            if (combobox.InvokeRequired)
            {
                combobox.Invoke(miClearItems);
            }
            else
            {
                miClearItems();
            }

            return selectedItem;
        }
开发者ID:NORENBUCH,项目名称:XrmToolBox,代码行数:20,代码来源:ComboboxDelegates.cs

示例8: GetSelectedIndexOfComboBox

        private int GetSelectedIndexOfComboBox(ComboBox comboBox)
        {
            if (comboBox.InvokeRequired)
                return (int)comboBox.Invoke(new Func<int>(() => GetSelectedIndexOfComboBox(comboBox)));

            return comboBox.SelectedIndex;
        }
开发者ID:qyh214,项目名称:SAI-Editor,代码行数:7,代码来源:SearchFromDatabaseForm.cs

示例9: getDropDownListValue

 private string getDropDownListValue(ComboBox ddlName, String columnName)
 {
     #region Variable
     var result = "";
     #endregion
     #region Procedure
     try
     {
         if (ddlName.InvokeRequired)
         {
             ddlName.Invoke(new MethodInvoker(delegate
             {
                 try
                 {
                     var drv = (DataRowView)ddlName.SelectedItem;
                     var dr = drv.Row;
                     try
                     {
                         result = dr[columnName].ToString();
                     }
                     catch (Exception)
                     {
                         result = dr[0].ToString();
                     }
                 }
                 catch (Exception)
                 {
                     result = "";
                 }
             }));
         }
         else
         {
             try
             {
                 var drv = (DataRowView)ddlName.SelectedItem;
                 var dr = drv.Row;
                 try
                 {
                     result = dr[columnName].ToString();
                 }
                 catch (Exception)
                 {
                     result = dr[0].ToString();
                 }
             }
             catch (Exception)
             {
                 result = "";
             }
         }
     }
     catch (Exception) { }
     #endregion
     return result;
 }
开发者ID:oofdui,项目名称:ContactCheckupSync,代码行数:56,代码来源:Report.cs

示例10: ComboxBind

 /// <summary>
 ///     combox数据绑定
 /// </summary>
 /// <param name="comboBox"></param>
 /// <param name="data"></param>
 private void ComboxBind(ComboBox comboBox, object data)
 {
     if (comboBox.InvokeRequired)
         comboBox.Invoke(new EventsHandlerComboxBind(ComboxBind), comboBox, data);
     else
     {
         var bs = new BindingSource { DataSource = data };
         comboBox.DataSource = bs;
         comboBox.DisplayMember = "Key";
         comboBox.ValueMember = "Value";
         comboBox.SelectedIndex = -1;
     }
 }
开发者ID:magicdict,项目名称:MongoCola,代码行数:18,代码来源:frmCopyDataBase.cs

示例11: setCbxText

 private void setCbxText(ComboBox cbx, string text)
 {
     if (cbx.InvokeRequired)
     {
         cbx.Invoke(new void__ComboBox_string(setCbxText), cbx, text);
     }
     else
     {
         cbx.Text = text;
     }
 }
开发者ID:fanjunwei,项目名称:My12306ForDotNet,代码行数:11,代码来源:Form1.cs

示例12: GetSelectedValue

 private object GetSelectedValue(ComboBox cbo)
 {
     object obj = null;
     if (cbo.InvokeRequired)
     {
         obj = cbo.Invoke((MyDelegate)delegate() { return obj = cbo.SelectedValue; });
         return obj;
     }
     else
     {
         return obj = cbo.SelectedValue;
     }
 }
开发者ID:moisesiq,项目名称:aupaga,代码行数:13,代码来源:ciudades.cs

示例13: updateComboBox

 private void updateComboBox(ComboBox cmb, string value, bool add)
 {
     if (cmb.InvokeRequired) { cmb.Invoke(new cmbDelegate(updateComboBox), new object[] { cmb, value, add }); } else {
         if (add) { cmb.Items.Add(value); } else { cmb.Items.Clear(); }
     }
 }
开发者ID:keithloughnane,项目名称:Omnipresent,代码行数:6,代码来源:VNCClientForm.cs

示例14: AddComboboxLine

        public void AddComboboxLine(ComboBox Destination, String newText, Int32 position=0, Int32 maxLength=10)
        {
            if(Destination.InvokeRequired)
                Destination.Invoke(new del_AddComboboxLine(AddComboboxLine), Destination, newText, position, maxLength);
            else
            {
                Destination.Items.Insert(position, newText);

                Destination.SelectedIndex = 0;

                while (Destination.Items.Count > maxLength)
                    Destination.Items.RemoveAt(Destination.Items.Count-1);
            }
        }
开发者ID:Duke-Jones,项目名称:ED-IBE,代码行数:14,代码来源:Form1.cs

示例15: readComboBox

 private string readComboBox(ComboBox box)
 {
     return (string)box.Invoke(new ReadComboDelegate(readComboHelper), new object[] { box });
 }
开发者ID:JamesNgai,项目名称:EDMSuite,代码行数:4,代码来源:ControllerWindow.cs


注:本文中的System.Windows.Forms.ComboBox.Invoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。