當前位置: 首頁>>代碼示例>>C#>>正文


C# Forms.CheckedListBox類代碼示例

本文整理匯總了C#中System.Windows.Forms.CheckedListBox的典型用法代碼示例。如果您正苦於以下問題:C# CheckedListBox類的具體用法?C# CheckedListBox怎麽用?C# CheckedListBox使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CheckedListBox類屬於System.Windows.Forms命名空間,在下文中一共展示了CheckedListBox類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddColumnsToCheckList

 private static void AddColumnsToCheckList(CheckedListBox checkList, RowCollection rowCollection)
 {
     foreach (var columnHeader in rowCollection.GetColumnHeaders())
     {
         checkList.Items.Add(columnHeader);
     }
 }
開發者ID:ArneD,項目名稱:unique-file-records-comparer,代碼行數:7,代碼來源:SelectColumnsForm.cs

示例2: DALControl

        public DALControl(string dbTableName, string PascalTableName, bool isPascal, string preNS,
            string preClass, string preModel,
            bool isLog, CheckedListBox checkedListBox1, EnumDbType dbType)
        {
            this.TableName = dbTableName;
            this.PascalTableName = PascalTableName;
            this.IsPascal = isPascal;
            this.PreNs = preNS;
            this.SbTemp = new StringBuilder();

            this.PreClass = preClass;
            this.PreModel = preModel;
            this.IsLog = isLog;
            this.CheckedListBox1 = checkedListBox1;
            this.DbType = dbType;

            if (this.DbType == EnumDbType.Oracle)
            {
                dbHelper = "DbHelperOracle";
                parameter = "OracleParameter";
                paramsHelper = "ParamsHelperOracle";
            }
            else if (this.DbType == EnumDbType.SqlServer)
            {
                dbHelper = "DbHelperSqlServer";
                parameter = "SqlParameter";
                paramsHelper = "ParamsHelperSqlServer";
            }

            listPrimaryKey = TableControl.GetPrimayKeys(dbTableName, this.DbType);
            dtColumns = ColumnControl.GetTableColumnsByTableName(dbTableName, this.DbType);
        }
開發者ID:Raman0716,項目名稱:MyCodeGenerate,代碼行數:32,代碼來源:DALControl.cs

示例3: ValidateCheckList

 public static bool ValidateCheckList(CheckedListBox boxes, ErrorProvider errorProvider)
 {
     if(boxes.CheckedItems.Count > 0)
         return true;
     errorProvider.SetError(boxes, "Este campo es obligatorio");
     return false;
 }
開發者ID:faloi,項目名稱:cuponete,代碼行數:7,代碼來源:ValidatorHelper.cs

示例4: foreach

 protected List<ushort>GetChecked(CheckedListBox list)
 {
     List<ushort> result = new List<ushort>();
     foreach (var c in list.CheckedItems)
         result.Add((c is Zone) ? ushort.Parse((c as Zone).Id) : (c as Terminal).ReferenceId);
     return result;
 }
開發者ID:emergent-design,項目名稱:quiche,代碼行數:7,代碼來源:UsersTab.cs

示例5: AdvancedFilter

        public void AdvancedFilter(string searchString, CheckedListBox.CheckedItemCollection checkedItems)
        {
            // Start from scratch
            gridView.Items.Clear();

            // Repopulate if empty search
            if (checkedItems.Count == 0 || searchString == "")
            {
                fullList.ForEach(item => gridView.Items.Add(item));
                return;
            }

            // For each video file showing:
            fullList.ForEach(item =>
            {
                // Big Linq Statement Translation:
                //  - Find tag entries from file that match type of checked items
                //  - Any entry that contains the search string, add that file to view
                var file = (VideoFile)item.Tag;
                if (checkedItems.Cast<Tag>().Select(tag =>
                    file.Tags.Find(entry => entry.TypeId == tag.Id)).
                        Any(match => match != null && match.Data.ToLower().Contains(searchString.ToLower())))
                {
                    gridView.Items.Add(item);
                }
            });
        }
開發者ID:Kaan0200,項目名稱:Zoodevio_VideoLibrary,代碼行數:27,代碼來源:GridViewControl.cs

示例6: GameManager

        /// <summary>
        /// The GameManager constructor - responsible for 
        /// initialising data-fields needed by a game 
        /// manager object.
        /// </summary>
        /// <param name="charactersListBox">A CheckedListBox to hold game characters.</param>
        /// <param name="battleResults">A ListBox to display the game's battle results.</param>
        /// <param name="noOfPlayersInBattle">The number of players which can be in a battle.</param>
        public GameManager(CheckedListBox charactersListBox, ListBox battleResults, int noOfPlayersInBattle)
        {
            ///<summary>
            ///Initialising the list of game characters
            ///</summary>
            this.characters = new List<Character>();

            ///<summary>
            ///Initialising the CheckedListBox the characters
            ///will be added to.
            ///</summary>
            this.charactersListBox = charactersListBox;

            ///<summary>
            ///Initialising the ListBox which will display
            ///the game battle results.
            ///</summary>
            this.battleResults = battleResults;

            ///<summary>
            ///Initialising the number of characters
            ///permitted in the game battle.
            ///</summary>
            this.noOfPlayersInBattle = noOfPlayersInBattle;
        }
開發者ID:rattfieldnz,項目名稱:StrategyDesignGame,代碼行數:33,代碼來源:GameManager.cs

示例7: AddElement

        /// <summary>
        /// add new element
        /// </summary>
        /// <param name="cbElements"></param>
        /// <param name="clbFactsAboutElements"></param>
        public void AddElement(ComboBox cbElements, CheckedListBox clbFactsAboutElements)
        {
            string elementName = cbElements.Text;
            cbElements.Items.Add(elementName);
            Dictionary<Guid, bool> factsAboutElement = new Dictionary<Guid, bool>();

            foreach (var item in clbFactsAboutElements.Items)
            {
                RuleArgumentListBoxItem factAboutElement = item as RuleArgumentListBoxItem;
                factsAboutElement.Add(factAboutElement.Id, factAboutElement.Value);
            }

            Guid elementId = dataAccessLayer.InsertElement(elementName, factsAboutElement);
            Element element = new Element
            {
                Id = elementId,
                Name = elementName,
                Facts = factsAboutElement.Select(fae => new FactAboutElement
                {
                    Id = fae.Key,
                    Value = fae.Value,
                    Name = inferenceModule.Facts.Find(f => f.Id == fae.Key).Name
                }).ToList()
            };

            inferenceModule.Elements.Add(element);
        }
開發者ID:marcinfoder,項目名稱:SystemEkspercki,代碼行數:32,代碼來源:Presenter.cs

示例8: Test_05_ChangingChannelSupportPersistsOnCommit

		public void Test_05_ChangingChannelSupportPersistsOnCommit()
		{
			CheckedListBox edPolicySupport = new CheckedListBox();
			ActionDetailController controller = new ActionDetailController();
			controller.PolicySupportControl = edPolicySupport;
			IResourceAction actionForTest = GetMockActionForTest();
			controller.Connect(actionForTest);

			List<PolicyType> policys = new List<PolicyType>(actionForTest.SupportedPolicySetting);
            Assert.AreEqual(1, policys.Count, "Should start as ActiveContent and ClientEmail");
            Assert.IsTrue(policys.Contains(PolicyType.ClientEmail), "Should start as ActiveContent and ClientEmail");

            //get first non client email policy in list
            int id = -1;
            for (int i = 0; i < edPolicySupport.Items.Count; i++)
            {
                if (edPolicySupport.Items[i].ToString() != "Client Email Policy")
                {
                    id = i;
                    break;
                }
            }
			edPolicySupport.SetItemChecked(id, true);
            policys = new List<PolicyType>(actionForTest.SupportedPolicySetting);
			Assert.AreEqual(1, policys.Count, "We haven't committed anything yet");
            Assert.IsTrue(policys.Contains(PolicyType.ClientEmail), "We haven't committed anything yet");

			controller.Commit();
            policys = new List<PolicyType>(actionForTest.SupportedPolicySetting);
			Assert.AreEqual(2, policys.Count, "We haven't committed anything yet");
            Assert.IsTrue(policys.Contains(PolicyType.ClientEmail), "We added ClientEmail, this should still be here");
		}
開發者ID:killbug2004,項目名稱:WSProf,代碼行數:32,代碼來源:TestActionDetailController.cs

示例9: EditValue

        /// <inheritdoc/>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            #region Sanity checks
            if (context == null) throw new ArgumentNullException(nameof(context));
            if (provider == null) throw new ArgumentNullException(nameof(provider));
            #endregion

            var languages = value as LanguageSet;
            if (languages == null) throw new ArgumentNullException(nameof(value));

            var editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (editorService == null) return value;

            var listBox = new CheckedListBox {CheckOnClick = true};
            int i = 0;
            foreach (var language in languages)
            {
                listBox.Items.Add(language);
                listBox.SetItemChecked(i++, true);
            }
            foreach (var language in Languages.AllKnown.Except(languages))
                listBox.Items.Add(language);

            editorService.DropDownControl(listBox);

            return new LanguageSet(listBox.CheckedItems.Cast<CultureInfo>());
        }
開發者ID:nano-byte,項目名稱:common,代碼行數:28,代碼來源:LanguageSetEditor.cs

示例10: LlenarChkbL_Desktop

 public bool LlenarChkbL_Desktop(CheckedListBox Generico)
 {
     if (!Validar())
             return false;
         try
         {
             clsConexionBD objConexionBd = new clsConexionBD(strApp);
             objConexionBd.SQL = strSQL;
             if (!objConexionBd.LlenarDataSet(false))
             {
                 strError = objConexionBd.Error;
                 objConexionBd.CerrarCnx();
                 objConexionBd = null;
                 return false;
             }
             Generico.DataSource = objConexionBd.DataSet_Lleno.Tables[0];
             Generico.ValueMember = strCampoID;
             Generico.DisplayMember = strCampoTexto;
             Generico.Refresh();
             objConexionBd.CerrarCnx();
             objConexionBd = null;
             return true;
         }
         catch (Exception ex)
         {
             strError = ex.Message;
             return false;
         }
 }
開發者ID:jdzapataduque,項目名稱:Cursos-Capacitando,代碼行數:29,代碼來源:ClsChkList.cs

示例11: GetSelectedItems

 public static TextPackage[] GetSelectedItems(CheckedListBox listBox, List<TextPackage> licenseCaptions)
 {
     List<TextPackage> packs = new List<TextPackage>();
     foreach (int index in listBox.CheckedIndices)
         packs.Add(licenseCaptions[index]);
     return packs.ToArray();
 }
開發者ID:GRGSIBERIA,項目名稱:ReadmeEditor,代碼行數:7,代碼來源:CheckedListMethod.cs

示例12: GetStudentUserListByYear

 /// <summary>
 /// GetStudentUserListByYear take StudentByYear sorted list created in the main program and the student years checkedlistbox and creates a hashtable
 /// that will be used to look up the user list to display in the combolistbox display. 
 /// This does not use wmi service, but is the logical place add this method. 
 /// </summary>
 /// <param name="slIn"></param>
 /// <param name="checkListBox"></param>
 /// <returns>sortlist</returns>
 public Hashtable GetStudentUserListByYear(SortedList slIn, CheckedListBox checkListBox)
 {
     Hashtable ht = new Hashtable();
     try
     {
         foreach (object itemChecked in checkListBox.CheckedItems)
         {
             ICollection keys = slIn.GetKeyList();
             foreach (string s in keys)
             {
                 if (s == itemChecked.ToString())
                 {
                     //this is the sortedlist of students for a given year
                     IList values = ((SortedList)slIn[s]).GetValueList();
                     //create the hashtable entries available students - this will be used to lookup and match students by year
                     foreach (string name in values)
                     {
                         ht.Add(name.ToUpper(), name.ToUpper());
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         //re-throw exception for main calling
         throw new Exception("WMIPropertiesHelper", e);
     }
     return (ht);
 }
開發者ID:mcdonald1212,項目名稱:ServerUtility,代碼行數:38,代碼來源:ServerUserCleanup.cs

示例13: CheckAll

 /// <summary>
 /// Checks all.
 /// </summary>
 /// <param name="cb">The cb.</param>
 /// <param name="value">if set to <c>true</c> [value].</param>
 public static void CheckAll(CheckedListBox cb, bool value)
 {
     for (var a = 0; a < cb.Items.Count; a++)
     {
         cb.SetItemChecked(a, value);
     }
 }
開發者ID:andreigec,項目名稱:ANDREICSLIB,代碼行數:12,代碼來源:CheckedListBoxExtras.cs

示例14: clearItemCheckList

 public static void clearItemCheckList(CheckedListBox check)
 {
     for (int item = 0; item < check.Items.Count; item++)
     {
         check.SetItemChecked(item, false);
     }
 }
開發者ID:MaximilianoFelice,項目名稱:gdd-2014,代碼行數:7,代碼來源:FormHandler.cs

示例15: llenarFuncionalidadesDeRol

        public static void llenarFuncionalidadesDeRol(CheckedListBox chkLstBox, String nombreRol)
        {
            chkLstBox.Items.Clear();
            bool activo;
            try
            {

                using (SqlConnection conn = new SqlConnection(main.connString))
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection = conn;
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "BONDIOLA.funcionalidades_asignadas_a_rol";
                    cmd.Parameters.Add(new SqlParameter("@nombreRol", nombreRol));
                    conn.Open();
                    SqlDataReader rdr = cmd.ExecuteReader();
                    while (rdr.Read())
                    {
                        activo = true;
                        if (String.Equals(rdr["Activo"], "0"))
                        {
                            activo = false;
                        }
                        chkLstBox.Items.Add((string)rdr["nombre_funcionalidad"], activo);
                    }
                }
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
開發者ID:juanmjacobs,項目名稱:gestion2c2013,代碼行數:32,代碼來源:Listado.cs


注:本文中的System.Windows.Forms.CheckedListBox類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。