예제 #1
0
 // [Popups] event. Click on button 'UpPopupBtn'
 private void UpPopupBtn_Click(object sender, EventArgs e)
 {
     if (PopupListView.SelectedIndices.Count > 0 && PopupListView.SelectedIndices[0] > 0) // > 0 => 1 - 1 = 0 (maximum up position)
     {
         ListViewItem itemToMove = PopupListView.SelectedItems[0];
         int          indexTo    = PopupListView.SelectedIndices[0] - 1;
         PopupListView.Items.RemoveAt(PopupListView.SelectedIndices[0]);
         PopupListView.Items.Insert(indexTo, itemToMove);
         PopupListView.Items[indexTo].Selected = PopupListView.Items[indexTo].Focused = true;
         PopupListView.Select();
     }
 }
예제 #2
0
 // [Popups] event. Click on button 'DownPopupBtn'
 private void DownPopupBtn_Click(object sender, EventArgs e)
 {
     if (PopupListView.SelectedIndices.Count > 0 && PopupListView.SelectedIndices[0] < PopupListView.Items.Count - 1)
     {
         ListViewItem itemToMove = PopupListView.SelectedItems[0];
         int          indexTo    = PopupListView.SelectedIndices[0] + 1;
         PopupListView.Items.RemoveAt(PopupListView.SelectedIndices[0]);
         PopupListView.Items.Insert(indexTo, itemToMove);
         PopupListView.Items[indexTo].Selected = PopupListView.Items[indexTo].Focused = true;
         PopupListView.Select();
     }
 }