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


C# CheckedListBox.GetItemText方法代码示例

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


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

示例1: 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

示例2: SetCheck

 public static void SetCheck(CheckedListBox cblItems, string valueList)
 {
     string[] strtemp = valueList.Split(',');
     foreach (string str in strtemp)
     {
         for (int i = 0; i < cblItems.Items.Count; i++)
         {
             if (cblItems.GetItemText(cblItems.Items[i]) == str)
             {
                 cblItems.SetItemChecked(i, true);
             }
         }
     }
 }
开发者ID:Andy-Yin,项目名称:MY_OA_RM,代码行数:14,代码来源:CheckBoxListUtil.cs

示例3: DrawCheckedListBoxItem

		public override void DrawCheckedListBoxItem (CheckedListBox ctrl, DrawItemEventArgs e)
		{			
			Color back_color, fore_color;
			Rectangle item_rect = e.Bounds;
			ButtonState state;

			/* Draw checkbox */		

			if ((e.State & DrawItemState.Checked) == DrawItemState.Checked) {
				state = ButtonState.Checked;
				if ((e.State & DrawItemState.Inactive) == DrawItemState.Inactive)
					state |= ButtonState.Inactive;
			} else
				state = ButtonState.Normal;

			if (ctrl.ThreeDCheckBoxes == false)
				state |= ButtonState.Flat;

			Rectangle checkbox_rect = new Rectangle (2, (item_rect.Height - 11) / 2, 13, 13);
			ControlPaint.DrawCheckBox (e.Graphics,
				item_rect.X + checkbox_rect.X, item_rect.Y + checkbox_rect.Y,
				checkbox_rect.Width, checkbox_rect.Height,
				state);

			item_rect.X += checkbox_rect.Right;
			item_rect.Width -= checkbox_rect.Right;
			
			/* Draw text*/
			if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
				back_color = ColorHighlight;
				fore_color = ColorHighlightText;
			}
			else {
				back_color = e.BackColor;
				fore_color = e.ForeColor;
			}
			
			e.Graphics.FillRectangle (ResPool.GetSolidBrush
				(back_color), item_rect);

			e.Graphics.DrawString (ctrl.GetItemText (ctrl.Items[e.Index]), e.Font,
				ResPool.GetSolidBrush (fore_color),
				item_rect, ctrl.StringFormat);
					
			if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) {
				CPDrawFocusRectangle (e.Graphics, item_rect,
					fore_color, back_color);
			}
		}
开发者ID:hindlemail,项目名称:mono,代码行数:49,代码来源:ThemeWin32Classic.cs


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