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


C# ComboBox.EndUpdate方法代码示例

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


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

示例1: PopulateAnalyzers

 internal void PopulateAnalyzers(ComboBox cbAnalyzers)
 {
     cbAnalyzers.BeginUpdate();
     cbAnalyzers.Items.Clear();
     cbAnalyzers.Items.AddRange(Analyzing.GetAnalyzerNames().ToArray());
     cbAnalyzers.EndUpdate();
 }
开发者ID:mammo,项目名称:LukeSharp,代码行数:7,代码来源:SearchTabPage.cs

示例2: Populate

 /// <summary>
 /// Clears and fills the control with the given data. 
 /// </summary>
 /// <param name="ctrl">Combobox control to fill</param>
 /// <param name="data">List of data</param>
 /// <param name="none">Flag to fill the first position with "None"</param>
 /// <remarks>Painting is suspended until after items have been added</remarks>
 public static void Populate(ComboBox ctrl, IList<dynamic> data, bool none)
 {
     ctrl.BeginUpdate();
     ctrl.Items.Clear();
     if (none)
         ctrl.Items.Add("<None>");
     for (int i = 1; i < data.Count; i++)
         ctrl.Items.Add(data[i].ToString());
     ctrl.EndUpdate();
 }
开发者ID:borisblizzard,项目名称:arcreator,代码行数:17,代码来源:ControlHelper.cs

示例3: BuildNamespacesList

		public static bool BuildNamespacesList(ComboBox help2Collections, string selectedHelp2Collection)
		{
			if (help2Collections == null)
			{
				throw new ArgumentNullException("help2Collections");
			}

			HxRegistryWalkerClass registryWalker;
			IHxRegNamespaceList help2Namespaces;
			try
			{
				registryWalker = new HxRegistryWalkerClass();
				help2Namespaces = registryWalker.get_RegisteredNamespaceList("");
			}
			catch (System.Runtime.InteropServices.COMException)
			{
				help2Namespaces = null;
				registryWalker = null;
			}

			if (registryWalker == null || help2Namespaces == null || help2Namespaces.Count == 0)
			{
				return false;
			}

			help2Collections.Items.Clear();
			help2Collections.BeginUpdate();
			try
			{
				string currentDescription = string.Empty;

				foreach (IHxRegNamespace currentNamespace in help2Namespaces)
				{
					help2Collections.Items.Add
						((string)currentNamespace.GetProperty(HxRegNamespacePropId.HxRegNamespaceDescription));

					if (!string.IsNullOrEmpty(selectedHelp2Collection) &&
					    string.Compare(selectedHelp2Collection, currentNamespace.Name) == 0)
					{
						currentDescription =
							(string)currentNamespace.GetProperty(HxRegNamespacePropId.HxRegNamespaceDescription);
					}
				}

				if (!string.IsNullOrEmpty(currentDescription))
					help2Collections.SelectedIndex = help2Collections.Items.IndexOf(currentDescription);
				else
					help2Collections.SelectedIndex = 0;
			}
			finally
			{
				help2Collections.EndUpdate();
			}
			return true;
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:55,代码来源:Help2RegistryWalker.cs

示例4: SetListItems

        public static void SetListItems(ComboBox comboBox, ListItemWithId[] items)
        {
            comboBox.Text = "";
            comboBox.Items.Clear();

            comboBox.BeginUpdate();

            for (int i = 0; i < items.Length; i++)
                comboBox.Items.Add(items[i]);

            comboBox.EndUpdate();
        }
开发者ID:gitfunk,项目名称:7thSea,代码行数:12,代码来源:SeventhSeaUtils.cs

示例5: Popola

        /// <summary>
        /// 
        /// </summary>
        /// <param name="comboBox"></param>
        /// <param name="lista"></param>
        public static void Popola(ref ComboBox comboBox, object lista, string DisplayMember, string ValueMember)
        {
            comboBox.BeginUpdate();

            comboBox.Items.Clear();

            // List<TipoUtensile> tipiUtensili = new TipoUtensileDao(MyApplication.GetConnection()).ListaOrdinata();
            if (lista != null)
            {
                comboBox.DataSource = lista;
                comboBox.DisplayMember = DisplayMember;
                comboBox.ValueMember = ValueMember;
            }
            comboBox.EndUpdate();
        }
开发者ID:mattocchi,项目名称:VS2005Commons,代码行数:20,代码来源:ComboBoxUtils.cs

示例6: LoadRemotes

        protected void LoadRemotes(GitClient client, ComboBox remoteBox)
        {
            var config = client.GetConfig(RepositoryPath);

            var currentBranch = client.GetCurrentBranch(RepositoryPath);

            string currentBranchRemote = config.GetString("branch", currentBranch.ShortName, "remote");

            remoteBox.BeginUpdate();
            remoteBox.Items.Clear();

            foreach (string remote in config.GetSubsections("remote"))
            {
                remoteBox.Items.Add(remote);

                if (remote == currentBranchRemote)
                    remoteBox.SelectedIndex = remoteBox.Items.Count - 1;
            }

            remoteBox.EndUpdate();
        }
开发者ID:pvginkel,项目名称:VisualGit,代码行数:21,代码来源:PushPullDialog.cs

示例7: UpdateCountryComboBox

        /// <summary>
        ///     国家コンボボックスを更新する
        /// </summary>
        /// <param name="control">コントロール</param>
        /// <param name="allowEmpty">空項目を許可するかどうか</param>
        private void UpdateCountryComboBox(ComboBox control, bool allowEmpty)
        {
            Graphics g = Graphics.FromHwnd(Handle);
            int margin = DeviceCaps.GetScaledWidth(2) + 1;

            int width = control.Width;
            control.BeginUpdate();
            control.Items.Clear();
            if (allowEmpty)
            {
                control.Items.Add("");
            }
            foreach (Country country in Countries.Tags)
            {
                string s = Countries.GetTagName(country);
                control.Items.Add(s);
                width = Math.Max(width,
                    (int) g.MeasureString(s, control.Font).Width + SystemInformation.VerticalScrollBarWidth + margin);
            }
            control.DropDownWidth = width;
            control.EndUpdate();
        }
开发者ID:nkodama,项目名称:HoI2Editor,代码行数:27,代码来源:ScenarioEditorForm.cs

示例8: LoadItemsIntoComboBox

 private void LoadItemsIntoComboBox( ComboBox combobox, IEnumerable<object> items )
 {
     combobox.BeginUpdate();
     foreach( var item in items )
         combobox.Items.Add(item);
     combobox.EndUpdate();
 }
开发者ID:mqrelly,项目名称:Syntan,代码行数:7,代码来源:RuleForm.cs

示例9: BeginEndUpdateTest

		public void BeginEndUpdateTest ()
		{
			Form myform = new Form ();
			myform.ShowInTaskbar = false;
			myform.Visible = true;
			ComboBox cmbbox = new ComboBox ();
			cmbbox.Items.Add ("A");
			cmbbox.Visible = true;
			myform.Controls.Add (cmbbox);
			cmbbox.BeginUpdate ();
			for (int x = 1 ; x < 5000 ; x++) {
				cmbbox.Items.Add ("Item " + x.ToString ());
			}
			cmbbox.EndUpdate ();
			myform.Dispose ();
		}
开发者ID:ngraziano,项目名称:mono,代码行数:16,代码来源:ComboBoxTest.cs

示例10: FormField

            public FormField(Field f, XDataForm form, int tabIndex)
            {
                m_field = f;
                m_type = f.Type;
                m_var = f.Var;
                m_val = f.Vals;
                m_required = f.IsRequired;
                m_form = form;

                Panel p = null;
                if (m_type != FieldType.hidden)
                {
                    p = new Panel();
                    p.Parent = m_form.pnlFields;
                    p.TabIndex = tabIndex;
                }

                switch (m_type)
                {
                    case FieldType.hidden:
                        break;
                    case FieldType.boolean:
                        CheckBox cb = new CheckBox();
                        cb.Checked = f.BoolVal;
                        cb.Text = null;
                        m_control = cb;
                        break;
                    case FieldType.text_multi:
                        TextBox mtxt = new TextBox();
                        mtxt.Multiline = true;
                        mtxt.ScrollBars = ScrollBars.Vertical;
                        mtxt.Lines = m_val;
                        mtxt.Height = m_form.btnOK.Height * 3;
                        m_control = mtxt;
                        break;
                    case FieldType.text_private:
                        TextBox ptxt = new TextBox();
                        ptxt.Lines = m_val;
                        ptxt.PasswordChar = '*';
                        m_control = ptxt;
                        break;
                    case FieldType.list_single:
                        ComboBox box = new ComboBox();
                        box.DropDownStyle = ComboBoxStyle.DropDownList;
                        box.BeginUpdate();
                        string v = null;
                        if (m_val.Length > 0)
                            v = m_val[0];
                        foreach (Option o in f.GetOptions())
                        {
                            int i = box.Items.Add(o);

                            if (o.Val == v)
                            {
                                box.SelectedIndex = i;
                            }
                        }
                        box.EndUpdate();
                        m_control = box;
                        break;

                    case FieldType.list_multi:
                        //ListBox lb = new ListBox();
                        CheckedListBox lb = new CheckedListBox();
                        //lb.SelectionMode = SelectionMode.MultiExtended;
                        lb.VisibleChanged += new EventHandler(lb_VisibleChanged);
                        m_control = lb;
                        break;

                    case FieldType.jid_single:
                        TextBox jtxt = new TextBox();
                        jtxt.Lines = m_val;
                        jtxt.Validating += new CancelEventHandler(jid_Validating);
                        jtxt.Validated += new EventHandler(jid_Validated);
                        m_control = jtxt;
                        m_form.error.SetIconAlignment(m_control, ErrorIconAlignment.MiddleLeft);
                        break;

                    case FieldType.jid_multi:
                        JidMulti multi = new JidMulti();
                        multi.AddRange(m_val);
                        m_control = multi;
                        break;

                    case FieldType.Fixed:
                        // All of this so that we can detect URLs.
                        // We can't just make it disabled, because then the URL clicked
                        // event handler doesn't fire, and there's no way to set the
                        // text foreground color.
                        // It would be cool to make copy work, but it doesn't work for
                        // labels, either.
                        RichTextBox rich = new RichTextBox();
                        rich.DetectUrls = true;
                        rich.Text = string.Join("\r\n", f.Vals);
                        rich.ScrollBars = RichTextBoxScrollBars.None;
                        rich.Resize += new EventHandler(lbl_Resize);
                        rich.BorderStyle = BorderStyle.None;
                        rich.LinkClicked += new LinkClickedEventHandler(rich_LinkClicked);
                        rich.BackColor = System.Drawing.SystemColors.Control;
                        rich.KeyPress += new KeyPressEventHandler(rich_KeyPress);
//.........这里部分代码省略.........
开发者ID:krbysn,项目名称:jabber-net,代码行数:101,代码来源:XDataForm.cs

示例11: InitializeTextEncodingComboBox

 public static void InitializeTextEncodingComboBox(ComboBox comboBox)
 {
     var defaultEncoding = Configuration.Settings.General.DefaultEncoding;
     var selectedItem = (TextEncodingListItem)null;
     comboBox.BeginUpdate();
     comboBox.Items.Clear();
     using (var graphics = comboBox.CreateGraphics())
     {
         var maxWidth = 0.0F;
         foreach (var encoding in Configuration.AvailableEncodings)
         {
             if (encoding.CodePage >= 949 && !encoding.IsEbcdic())
             {
                 var item = new TextEncodingListItem(encoding);
                 if (selectedItem == null && item.Equals(defaultEncoding))
                     selectedItem = item;
                 var width = graphics.MeasureString(item.DisplayName, comboBox.Font).Width;
                 if (width > maxWidth)
                     maxWidth = width;
                 if (encoding.CodePage.Equals(Encoding.UTF8.CodePage))
                     comboBox.Items.Insert(0, item);
                 else
                     comboBox.Items.Add(item);
             }
         }
         comboBox.DropDownWidth = (int)Math.Round(maxWidth + 7.5);
     }
     if (selectedItem == null)
         comboBox.SelectedIndex = 0; // UTF-8 if DefaultEncoding is not found
     else
         comboBox.SelectedItem = selectedItem;
     comboBox.EndUpdate();
     Configuration.Settings.General.DefaultEncoding = (comboBox.SelectedItem as TextEncodingListItem).Encoding.WebName;
 }
开发者ID:LeonCheung,项目名称:subtitleedit,代码行数:34,代码来源:UiUtil.cs

示例12: FillVariableCombo

 /// <summary>
 /// FillvariableCombo()
 /// </summary>
 /// <param name="cmb">ComboBox to be filled</param>
 /// <param name="scopeWord">The scope of the variable</param>
 protected void FillVariableCombo(ComboBox cmb, VariableType scopeWord)
 {
     cmb.Items.Clear();
     List<EpiInfo.Plugin.IVariable> vars = this.EpiInterpreter.Context.GetVariablesInScope((VariableScope)scopeWord);
     cmb.BeginUpdate();
     foreach (EpiInfo.Plugin.IVariable var in vars)
     {
         if (!(var is Epi.Fields.PredefinedDataField))
         {
             cmb.Items.Add(var.Name.ToString());
         }
     }
     cmb.EndUpdate();
     cmb.Sorted = true;
     cmb.Refresh();
 }
开发者ID:NALSS,项目名称:epiinfo-82474,代码行数:21,代码来源:CommandDesignDialog.cs

示例13: FillCombobox

        /// <summary>
        /// Fills given combobox with given values and saves selection.
        /// </summary>
        /// <param name="target">Combobox to fill.</param>
        /// <param name="values">Values to use.</param>
        private void FillCombobox(ComboBox target, string[] values)
        {
            // Store selected item
            object selected = target.SelectedItem;

            target.BeginUpdate();

            // Clear collection
            target.Items.Clear();

            // Add kinds if any
            if (values != null)
                target.Items.AddRange(values);
            
            // If stored selected item is valid, store it
            if (selected != null && target.Items.Contains(selected))
                target.SelectedItem = selected;
            // Otherwize select first item
            else if (target.Items.Count > 0)
                target.SelectedItem = target.Items[0];

            target.EndUpdate();
        } 
开发者ID:tdhieu,项目名称:openvss,代码行数:28,代码来源:IndexesEdit.cs

示例14: UpdateListItems


//.........这里部分代码省略.........
        {
            control.BeginUpdate();
            control.Items.Clear();
            ScenarioEditorItemId itemId = (ScenarioEditorItemId) control.Tag;
            UnitClass uc;
            switch (itemId)
            {
                case ScenarioEditorItemId.DivisionUnitType:
                case ScenarioEditorItemId.DivisionBrigadeType1:
                case ScenarioEditorItemId.DivisionBrigadeType2:
                case ScenarioEditorItemId.DivisionBrigadeType3:
                case ScenarioEditorItemId.DivisionBrigadeType4:
                case ScenarioEditorItemId.DivisionBrigadeType5:
                    List<UnitType> types = (List<UnitType>) GetListItems(itemId, division);
                    foreach (UnitType type in types)
                    {
                        control.Items.Add(Units.Items[(int) type]);
                    }
                    break;

                case ScenarioEditorItemId.DivisionModel:
                    uc = Units.Items[(int) division.Type];
                    for (int i = 0; i < uc.Models.Count; i++)
                    {
                        string name = uc.GetCountryModelName(i, settings.Country);
                        if (string.IsNullOrEmpty(name))
                        {
                            name = uc.GetModelName(i);
                        }
                        control.Items.Add(name);
                    }
                    break;

                case ScenarioEditorItemId.DivisionBrigadeModel1:
                    uc = Units.Items[(int) division.Extra1];
                    for (int i = 0; i < uc.Models.Count; i++)
                    {
                        string name = uc.GetCountryModelName(i, settings.Country);
                        if (string.IsNullOrEmpty(name))
                        {
                            name = uc.GetModelName(i);
                        }
                        control.Items.Add(name);
                    }
                    break;

                case ScenarioEditorItemId.DivisionBrigadeModel2:
                    uc = Units.Items[(int) division.Extra2];
                    for (int i = 0; i < uc.Models.Count; i++)
                    {
                        string name = uc.GetCountryModelName(i, settings.Country);
                        if (string.IsNullOrEmpty(name))
                        {
                            name = uc.GetModelName(i);
                        }
                        control.Items.Add(name);
                    }
                    break;

                case ScenarioEditorItemId.DivisionBrigadeModel3:
                    uc = Units.Items[(int) division.Extra3];
                    for (int i = 0; i < uc.Models.Count; i++)
                    {
                        string name = uc.GetCountryModelName(i, settings.Country);
                        if (string.IsNullOrEmpty(name))
                        {
                            name = uc.GetModelName(i);
                        }
                        control.Items.Add(name);
                    }
                    break;

                case ScenarioEditorItemId.DivisionBrigadeModel4:
                    uc = Units.Items[(int) division.Extra4];
                    for (int i = 0; i < uc.Models.Count; i++)
                    {
                        string name = uc.GetCountryModelName(i, settings.Country);
                        if (string.IsNullOrEmpty(name))
                        {
                            name = uc.GetModelName(i);
                        }
                        control.Items.Add(name);
                    }
                    break;

                case ScenarioEditorItemId.DivisionBrigadeModel5:
                    uc = Units.Items[(int) division.Extra5];
                    for (int i = 0; i < uc.Models.Count; i++)
                    {
                        string name = uc.GetCountryModelName(i, settings.Country);
                        if (string.IsNullOrEmpty(name))
                        {
                            name = uc.GetModelName(i);
                        }
                        control.Items.Add(name);
                    }
                    break;
            }
            control.EndUpdate();
        }
开发者ID:nkodama,项目名称:HoI2Editor,代码行数:101,代码来源:ScenarioEditorController.cs

示例15: UpdateItemValue

        /// <summary>
        ///     編集項目の値を更新する
        /// </summary>
        /// <param name="control">コントロール</param>
        /// <param name="settings">国家設定</param>
        public void UpdateItemValue(ComboBox control, CountrySettings settings)
        {
            ScenarioEditorItemId itemId = (ScenarioEditorItemId) control.Tag;
            switch (itemId)
            {
                case ScenarioEditorItemId.CountryRegularId:
                    Country country = (Country) (GetItemValue(itemId, settings) ?? Country.None);
                    control.SelectedIndex = Array.IndexOf(Countries.Tags, country) + 1;
                    break;

                case ScenarioEditorItemId.CabinetHeadOfState:
                case ScenarioEditorItemId.CabinetHeadOfGovernment:
                case ScenarioEditorItemId.CabinetForeignMinister:
                case ScenarioEditorItemId.CabinetArmamentMinister:
                case ScenarioEditorItemId.CabinetMinisterOfSecurity:
                case ScenarioEditorItemId.CabinetMinisterOfIntelligence:
                case ScenarioEditorItemId.CabinetChiefOfStaff:
                case ScenarioEditorItemId.CabinetChiefOfArmy:
                case ScenarioEditorItemId.CabinetChiefOfNavy:
                case ScenarioEditorItemId.CabinetChiefOfAir:
                    List<Minister> ministers = (List<Minister>) GetListItems(itemId);
                    control.BeginUpdate();
                    control.Items.Clear();
                    foreach (Minister minister in ministers)
                    {
                        control.Items.Add(minister.Name);
                    }
                    control.EndUpdate();
                    object val = GetItemValue(itemId, settings);
                    if (val != null)
                    {
                        control.SelectedIndex = ministers.FindIndex(minister => minister.Id == (int) val);
                    }
                    break;
            }
        }
开发者ID:nkodama,项目名称:HoI2Editor,代码行数:41,代码来源:ScenarioEditorController.cs


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