Exemplo n.º 1
0
        public void m_Del()
        {
            if (m_objViewer.m_lvw.Items.Count == 0 || m_objViewer.m_lvw.SelectedItems == null)
            {
                return;
            }
            if (m_objViewer.m_lvw.SelectedItems.Count <= 0)
            {
                return;
            }
            if (m_objViewer.m_lvw.SelectedItems[0].Tag == null)
            {
                return;
            }
            if (MessageBox.Show("确认删除该项吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }
            long lngRes = clsDomain.m_lngDelUsage(m_objViewer.m_lvw.SelectedItems[0].Tag.ToString());
            int  index  = m_objViewer.m_lvw.SelectedIndices[0];

            if (lngRes > 0)
            {
                m_objViewer.m_lvw.Items.Remove(m_objViewer.m_lvw.SelectedItems[0]);
            }
            if (m_objViewer.m_lvw.Items.Count > 0)
            {
                if (index > 0)
                {
                    m_objViewer.m_lvw.Items[index - 1].Selected = true;
                }
                else
                {
                    m_objViewer.m_lvw.Items[index].Selected = true;
                }
            }
        }