本文整理汇总了C#中System.Windows.Forms.ListViewItem.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# ListViewItem.Remove方法的具体用法?C# ListViewItem.Remove怎么用?C# ListViewItem.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ListViewItem
的用法示例。
在下文中一共展示了ListViewItem.Remove方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveItem
private void RemoveItem(ListViewItem selectedItem)
{
var index = selectedItem.Index;
selectedItem.Remove();
if (index < listViewChain.Items.Count)
{
listViewChain.Items[index].Selected = true;
}
else if (listViewChain.Items.Count > 0)
{
listViewChain.Items[listViewChain.Items.Count - 1].Selected = true;
}
ResizeLists();
UpdateButtons();
}
示例2: DeleteMail
void DeleteMail(ListViewItem item)
{
if (mailView.InvokeRequired)
{
mailView.Invoke(new DeleteMailsDelegate(DeleteMail), new object[] { item });
}
else
{
item.Remove();
}
}
示例3: UpdateFileListItem
public void UpdateFileListItem(AccountFileStates newFileState, ListViewItem fileItem)
{
if ((newFileState & AccountFileStates.Deleted) != 0)
{
fileItem.Remove();
return;
}
if ((newFileState & AccountFileStates.New) != 0)
{
fileItem.ForeColor = Color.Blue;
}
if ((newFileState & AccountFileStates.UnsyncronizedWithAllDrives) != 0)
{
fileItem.ForeColor = Color.Red;
}
if ((newFileState & AccountFileStates.UnsyncronizedWithStorage) != 0)
{
fileItem.Font = UnsyncronizedFileItemFont;
}
if ((newFileState & AccountFileStates.SyncronizedWithDrive) != 0)
{
fileItem.ForeColor = SystemColors.ControlText;
}
if ((newFileState & AccountFileStates.SyncronizedWithStorage) != 0)
{
fileItem.Font = Font;
}
if ((newFileState & AccountFileStates.Error) != 0)
{
fileItem.BackColor = Color.Red;
fileItem.ForeColor = Color.White;
}
if ((newFileState & AccountFileStates.PlacedOnlyDrive) != 0)
{
fileItem.BackColor = Color.LightGreen;
}
if ((newFileState & AccountFileStates.PlacedOnlyStorage) != 0)
{
fileItem.ForeColor = Color.Green;
}
}
示例4: removeItem
private void removeItem(ListViewItem li)
{
if (lstSchedule.InvokeRequired)
{
lstSchedule.Invoke(new intFunctionDelegateList(removeItem), li);
return;
}
if (li.Text.ToLower() == "wake up from sleep")
{
((WakeUP)li.Tag).CancelWakeUp();
}
else
{
((System.Threading.Timer)li.Tag).Dispose();
}
li.Remove();
}
示例5: RemoveActiveScript
public void RemoveActiveScript(ListViewItem lvw)
{
if (this.InvokeRequired)
{
MethodInvoker del = delegate
{
RemoveActiveScript(lvw);
};
this.Invoke(del);
}
else
{
if (lvw != null)
{
lvw.Remove();
tbpScripts.Text = StringValue.ActiveScripts + " (" + lvwActiveScripts.Items.Count.ToString() + ")";
}
}
}
示例6: updateListViewItem
private void updateListViewItem(ListViewItem lvi)
{
iFolderObject ifolderObject = (iFolderObject)lvi.Tag;
iFolderWeb ifolder = ifolderObject.iFolderWeb;
if (ifolder.State.Equals("Available") &&
(ifWebService.GetiFolder(ifolder.CollectionID) != null))
{
lock (ht)
{
ht.Remove(ifolder.ID);
}
lvi.Remove();
}
else
{
int imageIndex;
lvi.SubItems[0].Text = ifolder.Name;
lvi.SubItems[1].Text = ifolder.IsSubscription ? "" : ifolder.UnManagedPath;
lvi.SubItems[2].Text = stateToString(ifolderObject, out imageIndex);
lvi.ImageIndex = imageIndex;
if (lvi.Selected && (iFolderView.SelectedItems.Count == 1))
{
updateMenus(ifolder);
}
}
}
示例7: AddControloAut
private void AddControloAut(object Sender, ListViewItem ListViewItem)
{
GISADataset.IndexFRDCARow IndexFRDCARow = null;
IndexFRDCARow = (GISADataset.IndexFRDCARow)ListViewItem.Tag;
if (ListViewItem.ListView == lstVwSubTipoInformacional)
IndexFRDCARow.Selector = 1;
else if (ListViewItem.ListView == lstVwTipoInformacional)
IndexFRDCARow.Selector = -1;
ListViewItem.SubItems.Add(TranslationHelper.FormatBoolean(IndexFRDCARow.ControloAutRow.Autorizado));
ListViewItem.SubItems.Add(TranslationHelper.FormatBoolean(IndexFRDCARow.ControloAutRow.Completo));
// se se tratar de uma tipologia informacional garantir que existe apenas um item
if (ListViewItem.ListView == lstVwTipoInformacional) {
if (lstVwTipoInformacional.Items.Count > 1) {
GISADataset.IndexFRDCARow idxCARow = null;
switch (MessageBox.Show("Não pode existir mais que uma tipologia informacional. Deseja substituir a existente?", "Tipologia informacional", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)) {
case DialogResult.OK:
// eliminar todos as tipologias informacionais excepto a que acaba de ser adicionada
foreach (ListViewItem item in lstVwTipoInformacional.Items) {
if (!(item == ListViewItem)) {
idxCARow = (GISADataset.IndexFRDCARow)item.Tag;
item.Remove();
idxCARow.Delete();
}
}
break;
case DialogResult.Cancel:
// eliminar a tipologia informacional que acaba de ser adicionada
idxCARow = (GISADataset.IndexFRDCARow)ListViewItem.Tag;
ListViewItem.Remove();
idxCARow.Delete();
break;
}
}
// Mandar actualizar o PanelConteudoInformacional
this.TheGenericDelegate.Invoke();
}
}
示例8: RemoveListViewItem
private void RemoveListViewItem(ListViewItem listViewItem) {
if (listViewItem == null) throw new ArgumentNullException();
IRun run = listViewItem.Tag as IRun;
if (run != null) {
itemListViewItemMapping[run].Remove(listViewItem);
if (itemListViewItemMapping[run].Count == 0) {
DeregisterItemEvents(run);
itemListViewItemMapping.Remove(run);
}
}
listViewItem.Remove();
}
示例9: DisplayOutput
public void DisplayOutput(String output, ListViewItem lvw, bool clicked, bool cancelled = false)
{
if (this.InvokeRequired)
{
MethodInvoker del = delegate
{
DisplayOutput(output, lvw, clicked, cancelled);
};
this.Invoke(del);
}
else
{
if ((txtPShellOutput.Text.Length + output.Length + (Environment.NewLine + "psf > ").Length) > txtPShellOutput.MaxLength)
{
txtPShellOutput.Text = txtPShellOutput.Text.Substring(output.Length + 500, txtPShellOutput.Text.Length - (output.Length + 500));
}
txtPShellOutput.AppendText(output);
txtPShellOutput.AppendText(Environment.NewLine + "psf > ");
mincurpos = txtPShellOutput.Text.Length;
txtPShellOutput.SelectionStart = mincurpos;
if (clicked || cancelled)
{
//Not sure why this happens, but if you type the command the scroll to caret isn't needed.
//If you initiate a script or command by double clicking, or you abort the thread, you do.
txtPShellOutput.ScrollToCaret();
}
txtPShellOutput.ReadOnly = false;
if (lvw != null)
{
lvw.Remove();
tbpScripts.Text = "Active Scripts (" + lvwActiveScripts.Items.Count.ToString() + ")";
}
}
}
示例10: Trocar
private void Trocar(ListViewItem pri, ListViewItem seg)
{
lock (this)
{
int i = pri.Index;
pri.Remove();
seg.Remove();
lstFuncionários.Items.Insert(i - 1, pri);
lstFuncionários.Items.Insert(i, seg);
}
}
示例11: remove
private void remove(ListViewItem i)
{
if (lvPC.SelectedItems.Count > 0)
{
try
{
string nome, endereco;
nome = i.SubItems[0].Text;
endereco = i.SubItems[1].Text;
i.Remove();
log("Removido PC " + nome + " - " + endereco + " à lista de execução em lotes.");
//savelist();
}
catch (Exception ex)
{
log("Exception encontrada: " + ex.Message);
}
}
else
{
MessageBox.Show("ERRO: Selecione um item para ser excluido!");
}
}
示例12: listViewFormats_KeyDown
private void listViewFormats_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Insert:
{
CUEToolsFormat format;
if (_config.formats.TryGetValue("new", out format))
return;
format = new CUEToolsFormat("new", CUEToolsTagger.TagLibSharp, true, true, false, false, false, null, null, null);
_config.formats.Add("new", format);
ListViewItem item = new ListViewItem(format.extension, "." + format.extension);
item.Tag = format;
listViewFormats.Items.Add(item);
comboBoxEncoderExtension.Items.Add(format.extension);
comboBoxDecoderExtension.Items.Add(format.extension);
item.BeginEdit();
break;
}
case Keys.Delete:
{
if (listViewFormats.SelectedItems.Count <= 0)
return;
CUEToolsFormat format = (CUEToolsFormat)listViewFormats.SelectedItems[0].Tag;
if (format.builtin)
return;
List<string> decodersToRemove = new List<string>();
foreach (KeyValuePair<string, CUEToolsUDC> decoder in _config.decoders)
if (decoder.Value.extension == format.extension)
decodersToRemove.Add(decoder.Key);
foreach (string decoder in decodersToRemove)
{
_config.decoders.Remove(decoder);
foreach (ListViewItem item in listViewDecoders.Items)
if (item.Text == decoder)
{
item.Remove();
break;
}
}
List<string> encodersToRemove = new List<string>();
foreach (CUEToolsUDC encoder in _config.encoders)
if (encoder.extension == format.extension)
encodersToRemove.Add(encoder.name);
foreach (string encoder in encodersToRemove)
_config.encoders.Remove(_config.encoders[encoder]);
comboBoxEncoderExtension.Items.Remove(format.extension);
comboBoxDecoderExtension.Items.Remove(format.extension);
_config.formats.Remove(format.extension);
listViewFormats.SelectedItems[0].Remove();
break;
}
}
}
示例13: removeAttendee
// Remove selected item
private void removeAttendee(ListViewItem lvi)
{
int guestID = Convert.ToInt32(lvi.SubItems[2].Text);
lvi.Remove();
// find row in Datatable using GUEST_ID
DataRow[] removeRow = AttendeeDT.Select("GUEST_ID = " + guestID.ToString());
if (removeRow.Length > 0)
{
int SelectedIndex = AttendeeDT.Rows.IndexOf(removeRow[0]);
AttendeeDT.Rows.RemoveAt(SelectedIndex);
updateGuestCount();
}
CheckGuestCount();
}
示例14: updateFilterForUnbudgetingPart
/// <summary>
/// If the list view is filtered to display only budgeted part, in case the user un-budget a part
/// (i.e. delete its budget), we need to make it disapear from the list of item and place it in the
/// not budgeted part temporary list
/// </summary>
/// <param name="unbudgetedItem">The item whose budget was removed</param>
private void updateFilterForUnbudgetingPart(ListViewItem unbudgetedItem)
{
if (Budget.Budget.Instance.ShouldShowOnlyBudgetedParts)
{
// search in the item list and in the filtered list (but this last case should never happe
// as the item must be in the list to be un-bugeted, otherwise the user cannot edit its buget)
if (this.Items.Contains(unbudgetedItem))
{
unbudgetedItem.Remove();
// then add it to the list of unbugeted items
mNotBudgetedItems.Add(unbudgetedItem);
}
else if (this.mFilteredItems.Contains(unbudgetedItem))
{
this.mFilteredItems.Remove(unbudgetedItem);
// then add it to the list of unbugeted items
mNotBudgetedItems.Add(unbudgetedItem);
}
}
}