本文整理匯總了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;
}
}