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


C# CheckedListBox.SetSelected方法代码示例

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


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

示例1: make_all

 private void make_all(int num_of_drives)
 {
     comparision1st = false;
     clear_baseline();
     int n = num_of_drives;
     int offx, offy, modd;
     int d = drives.Count;
     offx = 0; offy = 0;
     // make them on the run
     if (n > 12) { modd = 12; } else { modd = 4; }
     for (int i = 1; i <= n; i++)
     {
         CheckedListBox ata = new CheckedListBox();
         Label lata = new Label();
         ContextMenu mtt = new ContextMenu();
         ContextMenuStrip mt = new ContextMenuStrip();
         ata.Name = "ata" + i.ToString();
         lata.Name = "lata" + i.ToString();
         ata.Size = new Size(pref_w, pref_h);
         ata.Font = new Font(ata.Font.FontFamily, 7);
         ata.Location = new Point(pata_lx + offx, pata_ly + offy);
         lata.Height = pref_h;
         lata.Width = pref_w;
         lata.Location = new Point(plab_lx + offx, plab_ly + offy + 4);
         lata.Text = "Drive" + i.ToString();
         for (int j = 0; j < d; j++)
         {
             ata.Items.Add(drives[j] + " GB", false);
         }
         ata.CheckOnClick = true;
         ata.SetSelected(0, false);
         ata.TabIndex = i + 4;
         ata.ContextMenuStrip = cms;
         this.Controls.Add(ata);
         this.Controls.Add(lata);
         ata.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(ata_ItemCheck);
         ata.MouseUp += new System.Windows.Forms.MouseEventHandler(ata_MouseUp);
         offx += pref_w + 10;
         if (((i % modd) == 0) & (i != 1))
         {  // first drive is 1 then 6th drive is 0
             offx = 0;
             offy += 110; // that equals 133
         }
     }
     int sw, sh, sw1, sh1;
     // get sizes after all controls besides the listbox are there to help size the listbox
     sw = this.PreferredSize.Width;
     sh = this.PreferredSize.Height;
     sw1 = 0;
     sh1 = 0;
     //ListBox lbr = new ListBox();
     RichTextBox lbr = new RichTextBox();
     lbr.Name = "lbr";
     //  lbr.HorizontalScrollbar = true;
     lbr.Size = new Size(sw - 25, 280); //used to be 390 then 350 then 280
     lbr.Location = new Point(10, sh - 20);
     // lbr.ZoomFactor = 0.5;// convert.float(zoomfactor);
     lbr.Font = new Font(lbr.Font.FontFamily, fsizereg, lbr.Font.Style);
     this.Controls.Add(lbr);
     // resize the window
     sw1 = this.PreferredSize.Width;
     sh1 = this.PreferredSize.Height;
     this.Width = sw1 + 10;
     this.Height = sh1 + 5;
     numberofdrives = n;
 }
开发者ID:kossboss,项目名称:volsizecalculator,代码行数:66,代码来源:Form1.cs

示例2: CheckAllListboxItems

        /// <summary>
        /// Check all items in a checked list box
        /// </summary>
        /// <param name="listBox">The checked list box to modify</param>
        private void CheckAllListboxItems(CheckedListBox listBox)
        {
            if (listBox.Items.Count <= 0)
            {
                return;
            }

            for (int listBoxIndex = 0; listBoxIndex < listBox.Items.Count; listBoxIndex++)
            {
                listBox.SetSelected(listBoxIndex, true);
            }
        }
开发者ID:jack06215,项目名称:tmc,代码行数:16,代码来源:ReportControl.cs

示例3: topSelection

 public static void topSelection(CheckedListBox tab)
 {
     if (tab.SelectedIndex.ToString() != "-1")
     {
         bool etatItem = tab.GetItemChecked(tab.SelectedIndex);
         int index;
         string valeur;
         while (tab.SelectedIndex > 0)
         {
             valeur = tab.SelectedItem.ToString();
             index = tab.SelectedIndex;
             tab.Items.RemoveAt(index);
             tab.Items.Insert(index - 1, valeur);
             tab.SetSelected(index - 1, true);
         }
         tab.SetItemChecked(tab.SelectedIndex, etatItem);
     }
 }
开发者ID:ChristopheTdn,项目名称:GOS-SERVER-ARMA3,代码行数:18,代码来源:Interface.cs

示例4: diminueSelection

 public static void diminueSelection(CheckedListBox tab)
 {
     if (tab.SelectedIndex.ToString() != "-1")
     {
         if (tab.SelectedIndex < tab.Items.Count - 1)
         {
             bool etatItem = tab.GetItemChecked(tab.SelectedIndex);
             string valeur = tab.SelectedItem.ToString();
             int index = tab.SelectedIndex;
             tab.Items.RemoveAt(index);
             tab.Items.Insert(index + 1, valeur);
             tab.SetItemChecked(index + 1, etatItem);
             tab.SetSelected(index + 1, true);
         }
     }
 }
开发者ID:ChristopheTdn,项目名称:GOS-SERVER-ARMA3,代码行数:16,代码来源:Interface.cs

示例5: FilterListItem

 private void FilterListItem(CheckedListBox clb, string filter)
 {
     if (string.IsNullOrEmpty(filter))
         return;
     ListItem li;
     for (int i = 0; i < clb.Items.Count; i++)
     {
         li = clb.Items[i] as ListItem;
         if (li.Value.StartsWith(filter, StringComparison.CurrentCultureIgnoreCase))
         {
             clb.SetSelected(i, true);
             break;
         }
     }
 }
开发者ID:RickyLin,项目名称:DotNetUtilities,代码行数:15,代码来源:MainForm.cs

示例6: limpiarCheckboxList

 public static void limpiarCheckboxList(CheckedListBox cbl)
 {
     foreach (int i in cbl.CheckedIndices)
     {
         cbl.SetItemCheckState(i, CheckState.Unchecked);
         cbl.SetSelected(i,false);
     }
 }
开发者ID:TP-GDD-1C2014,项目名称:TPGDD,代码行数:8,代码来源:Interfaz.cs


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