コード例 #1
0
ファイル: ExtendedListView.cs プロジェクト: sakpung/webstudy
 protected virtual void OnItemDeselecting(ItemChangingEventArgs e)
 {
     if (ItemDeselecting != null)
     {
         ItemDeselecting(this, e);
     }
 }
コード例 #2
0
ファイル: ExtendedListView.cs プロジェクト: sakpung/webstudy
        private void ItemStateChanging(ref Message m, ref NMLISTVIEW nmlv)
        {
            if ((nmlv.uChanged & LVIF_STATE) == LVIF_STATE)
            {
                if ((nmlv.uOldState == LVIS_SELECTED) || //FROM ITEM
                    (nmlv.uNewState == LVIS_UNSELECTED))
                {
                    if (m_cancel)
                    {
                        m.Result = new IntPtr(1);
                        m_cancel = false;
                    }
                    else
                    {
                        if ((nmlv.uOldState == LVIS_SELECTED) && //FROM ITEM
                            (nmlv.uNewState == LVIS_UNSELECTED))
                        {
                            ItemChangingEventArgs e = new ItemChangingEventArgs(nmlv.iItem, this.Items[nmlv.iItem]);

                            OnItemDeselecting(e);
                            if (e.Cancel)
                            {
                                m.Result = new IntPtr(1);
                                m_cancel = true;
                            }
                        }
                    }
                }
                else if ((nmlv.uOldState == LVIS_UNSELECTED) || //TO ITEM
                         (nmlv.uNewState == LVIS_SELECTED) ||
                         (nmlv.uNewState == LVIS_SELECTED_FOCUSED))
                {
                    if (m_cancel)
                    {
                        m.Result = new IntPtr(1);
                        m_cancel = false;
                    }
                }
            }
        }