本文整理汇总了C#中System.Windows.Forms.ListBox.GetSelected方法的典型用法代码示例。如果您正苦于以下问题:C# ListBox.GetSelected方法的具体用法?C# ListBox.GetSelected怎么用?C# ListBox.GetSelected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ListBox
的用法示例。
在下文中一共展示了ListBox.GetSelected方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveSelectedObjects
public static void RemoveSelectedObjects(ListBox lst, ArrayList Arr = null)
{
if (lst == null) return;
int MaxPos = 0;
for (int k = 0; k < lst.Items.Count; k++)
{
if (lst.GetSelected(k))
{
MaxPos = k;
lst.Items.RemoveAt(k);
if (Arr != null)
Arr.RemoveAt(k);
k--;
}
}
if (lst.Items.Count > 0)
if (MaxPos < lst.Items.Count)
lst.SetSelected(MaxPos, true);
else
lst.SetSelected(lst.Items.Count - 1, true);
}
示例2: valueChecked
private bool valueChecked(Value value, ListBox ckdListBox)
{
bool retVal = false;
for (int i = 0; i < ckdListBox.Items.Count; i++)
{
string val = value.getValue() + "-" + value.getDescription();
if ((val.Equals(ckdListBox.Items[i])) & ckdListBox.GetSelected(i))
{
retVal = true;
break;
}
}
return retVal;
}
示例3: ListBoxSelectedItemsRemove
private void ListBoxSelectedItemsRemove(ListBox listBox)
{
if (listBox.SelectedItems.Count == 0)
{
return;
}
if (MessageBox.Show("确定移除选中目录?", "提示", MessageBoxButtons.YesNo) == DialogResult.No)
{
return;
}
for (int index = listBox.Items.Count - 1; index >= 0; index--)
{
FolderInfo folderInfo = listBox.Items[index] as FolderInfo;
if (listBox.GetSelected(index) && !folderInfo.IsRunning)
{
listBox.Items.RemoveAt(index);
}
}
}
示例4: unSelectAll
//反选
private void unSelectAll(ListBox ListBox)
{
bool b;
for (int i = 0; i < ListBox.Items.Count; i++)
{
b = !ListBox.GetSelected(i);
ListBox.SetSelected(i, b);
}
}
示例5: MoveListboxItemsFromTo
private void MoveListboxItemsFromTo(ListBox lbFrom, ListBox lbTo)
{
lbFrom.BeginUpdate();
lbTo.BeginUpdate();
try
{
for (int i = lbFrom.Items.Count - 1; i > -1; i--)
{
if (lbFrom.GetSelected(i) == true)
{
lbTo.Items.Add(lbFrom.Items[i]);
lbFrom.Items.Remove(lbFrom.Items[i]);
}
}
}
finally
{
lbTo.EndUpdate();
lbFrom.EndUpdate();
cbSelectiTunes.Checked = false;
cbSelectConvert.Checked = false;
}
}