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


C# CheckedListBox.GetItemChecked方法代码示例

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


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

示例1: EditValue

        /// <summary>
        /// Edits a value based on some user input which is collected from a character control.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            _dialogProvider = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            List<int> layerList = new List<int>();
            LayoutLegend legend = context.Instance as LayoutLegend;
            LayoutMap map = null;
            if (legend != null)
                map = legend.Map;
            if (map == null)
                return layerList;

            CheckedListBox lb = new CheckedListBox();
            
            List<int> originalList = value as List<int>;
            if (originalList != null)
            {
                for (int i = map.MapControl.Layers.Count - 1; i >= 0 ; i--)
                    lb.Items.Add(map.MapControl.Layers[i].LegendText, originalList.Contains(i));
            }
            
            _dialogProvider.DropDownControl(lb);

            for (int i = 0; i < lb.Items.Count; i ++)
            {
                if (lb.GetItemChecked(i))
                    layerList.Add(lb.Items.Count - 1 -i);
            }

            return layerList;
        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:37,代码来源:LayoutLayerEditor.cs

示例2: GetMaterials

 private void GetMaterials(ref EDPlanet obj, CheckedListBox box)
 {
     for (int i = 0; i < box.Items.Count; i++)
     {
         string item = (string)box.Items[i];
         MaterialEnum mat = obj.MaterialFromString(item);
         obj.materials[mat] =  box.GetItemChecked(i);
     }
 }
开发者ID:Udomyr,项目名称:EDDiscovery,代码行数:9,代码来源:PlanetsForm.cs

示例3: checkBoxListEmpty

        public static Boolean checkBoxListEmpty(CheckedListBox cbl)
        {
            for (int i = 0; i < cbl.Items.Count; i++)
            {
                if (cbl.GetItemChecked(i) == true) return false;
            }
            return true;

        }
开发者ID:MaximilianoFelice,项目名称:gdd-2014,代码行数:9,代码来源:FormHandler.cs

示例4: CheckedListBoxItemsAreAllUnchecked

 private bool CheckedListBoxItemsAreAllUnchecked(CheckedListBox listbox)
 {
     for (int i = 0; i < listbox.Items.Count; i++)
     {
         if (listbox.GetItemChecked(i))
             return false;
     }
     return true;
 }
开发者ID:killbug2004,项目名称:WSProf,代码行数:9,代码来源:ActionDetailUI.cs

示例5: UpdateActiveSitesInSetup

 public void UpdateActiveSitesInSetup(CheckedListBox sitesList)
 {
     ActiveSites.Clear();
     for (var index = 0; index < sitesList.Items.Count; index++)
     {
         var active = sitesList.GetItemChecked(index);
         if (active)
         {
             ActiveSites.Add((string) (sitesList.Items[index]));
         }
     }
 }
开发者ID:nus-ii,项目名称:MPTagThat,代码行数:12,代码来源:Setup.cs

示例6: GetCheckedItems

 public static string GetCheckedItems(CheckedListBox cblItems)
 {
     string resultList = "";
     for (int i = 0; i < cblItems.CheckedItems.Count; i++)
     {
         if (cblItems.GetItemChecked(i))
         {
             resultList += string.Format("{0},", cblItems.GetItemText(cblItems.Items[i]));
         }
     }
     return resultList.Trim(',');
 }
开发者ID:Andy-Yin,项目名称:MY_OA_RM,代码行数:12,代码来源:CheckBoxListUtil.cs

示例7: get_CheckListBox

 public static String get_CheckListBox(CheckedListBox chk)
 {
     string tmp = "";
     for (int r = 0; r < chk.Items.Count; r++)
     {
         if (chk.GetItemChecked(r))
         {
             string ID = ((ListItem)chk.Items[r]).ID;
             tmp += " " + ID;
         }
     }
     return tmp.Trim();
 }
开发者ID:jacean,项目名称:RingsII,代码行数:13,代码来源:Tools.cs

示例8: getStrings

        private void getStrings(CheckedListBox listBox, ref StringList strings)
        {
            int i;

            for (i = 0; i < listBox.Items.Count; i++)
            {
                if (listBox.GetItemChecked(i))
                {
                    String itemText = listBox.Items[i].ToString();
                    strings.Add(itemText);
                }
            }
        }
开发者ID:HazenBabcock,项目名称:LDView,代码行数:13,代码来源:MismatchForm.cs

示例9: DualChListMouseEvent

 /// <summary>
 /// Left mouse click: check/uncheck the item.
 /// Middle mouse click: remove item.
 /// Right mouse click: send item from chList1 to chList2.
 /// </summary>
 /// <param name="chList1"> The handled checkedListBox. </param>
 /// <param name="chList2"> The dual checkedListBox. </param>
 /// <param name="e"> The mouse click event. </param>
 public static void DualChListMouseEvent(CheckedListBox chList1, CheckedListBox chList2, MouseEventArgs e, Point mousePosition, bool useDual = true)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         for (int i = 0; i < chList1.Items.Count; i++)
         {
             if (i != 0 || useDual)
             {
                 if (chList1.GetItemRectangle(i).Contains(chList1.PointToClient(mousePosition)))
                 {
                     chList2.AddOrderedFromBottom(chList1.GetText(i), chList1.GetItemChecked(i));
                     chList1.Items.RemoveAt(i);
                 }
             }
         }
     }
     else if (e.Button == System.Windows.Forms.MouseButtons.Middle)
     {
         for (int i = 0; i < chList1.Items.Count; i++)
         {
             if (i != 0 || useDual)
             {
                 if (chList1.GetItemRectangle(i).Contains(chList1.PointToClient(mousePosition)))
                 {
                     chList1.Items.RemoveAt(i);
                 }
             }
         }
     }
     else if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         for (int i = 0; i < chList1.Items.Count; i++)
         {
             if (chList1.GetItemRectangle(i).Contains(chList1.PointToClient(mousePosition)))
             {
                 switch (chList1.GetItemCheckState(i))
                 {
                     case CheckState.Checked:
                         chList1.SetItemCheckState(i, CheckState.Unchecked);
                         break;
                     case CheckState.Indeterminate:
                     case CheckState.Unchecked:
                         chList1.SetItemCheckState(i, CheckState.Checked);
                         break;
                 }
             }
         }
     }
 }
开发者ID:PabloCorso,项目名称:BattleNotifier,代码行数:57,代码来源:Utils.cs

示例10: SetExcludes

        /// <summary>
        /// Save the excludes to the UserFilters
        /// </summary>
        /// <param name="listbox"></param>
        /// <param name="userExcludeTypes"></param>
        private void SetExcludes(CheckedListBox listbox, List<Type> userExcludeTypes)
        {
            for (int i = 0; i < listbox.Items.Count; i++)
            {
                Type typeObj = (Type)listbox.Items[i];

                if (listbox.GetItemChecked(i))
                {
                    if (!userExcludeTypes.Contains(typeObj))
                        userExcludeTypes.Add(typeObj);
                }
                else
                    userExcludeTypes.Remove(typeObj);
            }
        }
开发者ID:bnaand,项目名称:xBim-Toolkit,代码行数:20,代码来源:ClassFilter.cs

示例11: CheckedListValidator

        public static bool CheckedListValidator(CheckedListBox ch)
        {
            var hasChecked = false;
            for (int i = 0; i < ch.Items.Count; i++)
            {
                if (ch.GetItemChecked(i))
                {
                    hasChecked = true;
                    break;
                }
            }
            if (hasChecked==false)
            {
                return false;
            }

            return true;
        }
开发者ID:rafareyes7,项目名称:UnifyWS,代码行数:18,代码来源:HandyClass.cs

示例12: selectItemIndex

        public static int selectItemIndex(CheckedListBox clb)
        {
            for (int i = 0; i < clb.Items.Count; i++)
            {
                if (clb.GetItemChecked(i)) return i;

            }
            return 0;
        }
开发者ID:MaximilianoFelice,项目名称:gdd-2014,代码行数:9,代码来源:FormHandler.cs

示例13: listDown

    private void listDown(CheckedListBox listBox)
    {
      if (listBox.SelectedIndex == -1 || listBox.SelectedIndex == listBox.Items.Count - 1)
        return;

      object selected;
      object next;
      object temp;

      bool selectedChecked;
      bool nextChecked;
      bool tempChecked;

      selected = listBox.Items[listBox.SelectedIndex];
      selectedChecked = listBox.GetItemChecked(listBox.SelectedIndex);
      next = listBox.Items[listBox.SelectedIndex + 1];
      nextChecked = listBox.GetItemChecked(listBox.SelectedIndex + 1);

      temp = selected;
      tempChecked = selectedChecked;
      selected = next;
      selectedChecked = nextChecked;
      next = temp;
      nextChecked = tempChecked;

      listBox.Items[listBox.SelectedIndex] = selected;
      listBox.SetItemChecked(listBox.SelectedIndex, selectedChecked);
      listBox.Items[listBox.SelectedIndex + 1] = next;
      listBox.SetItemChecked(listBox.SelectedIndex + 1, nextChecked);

      listBox.SelectedIndex++;
    }
开发者ID:shengqh,项目名称:RCPA.Core,代码行数:32,代码来源:RcpaSelectList.cs

示例14: ApplyTags

        public static void ApplyTags(string key, CheckedListBox box, ItemCheckEventArgs e)
        {
            if (Resetting > 0) return;

            object[] vals = new object[box.CheckedItems.Count + (e.NewValue == CheckState.Checked ? 1 : -1)];
            int d = 0;
            for (int c = 0; c < box.Items.Count; c++)
            {
                if (box.GetItemChecked(c))
                {
                    if (c != e.Index || e.NewValue != CheckState.Unchecked)
                    {
                        vals[d] = box.Items[c].ToString();
                        d++;
                    }
                }
            }
            if (e.NewValue == CheckState.Checked)
                vals[d] = box.Items[e.Index].ToString();

            if (key.Equals("material") && vals.Length == 1)
                ApplyValue(key, vals[0], ((JsonFormTag)box.Tag).mandatory);
            else
                ApplyValue(key, vals, ((JsonFormTag)box.Tag).mandatory);
        }
开发者ID:BrianMacIntosh,项目名称:SpaceTool,代码行数:25,代码来源:WinformsUtil.cs

示例15: GetItemCheckedExceptionTest

		public void GetItemCheckedExceptionTest ()
		{
			CheckedListBox mychklistbox = new CheckedListBox ();
			mychklistbox.Items.Add ("test1",true);
			Assert.AreEqual (true, mychklistbox.GetItemChecked (1), "#13");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:6,代码来源:CheckedListBoxTest.cs


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