Esempio n. 1
0
 protected override void OnVirtualItemsSelectionRangeChanged(
     ListViewVirtualItemsSelectionRangeChangedEventArgs e)
 {
     try
     {
         int start = _lastItemIndexClicked1;
         int end = _lastItemIndexClicked2;
         if (end < start)
         {
             int temp = start;
             start = end;
             end = temp;
         }
         if ((start >= 0) && (end >= 0))
         {
             ArrayList toRemove = new ArrayList();
             foreach (int index in SelectedIndices)
             {
                 if ((index < start) || (index > end))
                     toRemove.Add(index);
             }
             if (toRemove.Count > 0)
             {
                 foreach (int index in toRemove)
                 {
                     SelectedIndices.Remove(index);
                 }
             }
         }
         ListViewVirtualItemsSelectionRangeChangedEventArgs te =
             new ListViewVirtualItemsSelectionRangeChangedEventArgs(start,
                                                                    end, e.IsSelected);
         base.OnVirtualItemsSelectionRangeChanged(te);
     }
     catch
     {
     }
 }
 private void EnCambioDeItemsSeleccionados(object laLista, ListViewVirtualItemsSelectionRangeChangedEventArgs losArgumentos)
 {
     EnCambioDeItemsSeleccionados(laLista, (EventArgs)losArgumentos);
 }
Esempio n. 3
0
		private void _culturesList_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e)
		{
			SetDelButtonState();
		}
Esempio n. 4
0
		protected virtual void OnVirtualItemsSelectionRangeChanged (ListViewVirtualItemsSelectionRangeChangedEventArgs e)
		{
			ListViewVirtualItemsSelectionRangeChangedEventHandler eh = 
				(ListViewVirtualItemsSelectionRangeChangedEventHandler) Events [VirtualItemsSelectionRangeChangedEvent];
			if (eh != null)
				eh (this, e);
		}
 private void processingListView_VirtualItemsSelectionRangeChanged( object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e )
 {
     processingListView_SelectedIndexChanged( sender, e );
 }
Esempio n. 6
0
 private void WatchListView_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e)
 {
     PokeAddressToolBarItem.Enabled =
         FreezeAddressToolBarItem.Enabled =
         SelectedIndices.Any() &&
         SelectedWatches.All(w => w.Domain.CanPoke());
 }
Esempio n. 7
0
        private unsafe void WmReflectNotify(ref Message m) {

            NativeMethods.NMHDR* nmhdr = (NativeMethods.NMHDR*)m.LParam;

            switch (nmhdr->code) {
                case NativeMethods.NM_CUSTOMDRAW:
                    CustomDraw(ref m);
                    break;

                case NativeMethods.LVN_BEGINLABELEDITA:
                case NativeMethods.LVN_BEGINLABELEDITW: {
                        NativeMethods.NMLVDISPINFO_NOTEXT nmlvdp = (NativeMethods.NMLVDISPINFO_NOTEXT)m.GetLParam(typeof(NativeMethods.NMLVDISPINFO_NOTEXT));
                        LabelEditEventArgs e = new LabelEditEventArgs(nmlvdp.item.iItem);
                        OnBeforeLabelEdit(e);
                        m.Result = (IntPtr)(e.CancelEdit ? 1 : 0);
                        listViewState[LISTVIEWSTATE_inLabelEdit] = !e.CancelEdit;
                        break;
                    }

                case NativeMethods.LVN_COLUMNCLICK: {
                        NativeMethods.NMLISTVIEW nmlv = (NativeMethods.NMLISTVIEW)m.GetLParam(typeof(NativeMethods.NMLISTVIEW));
                        listViewState[LISTVIEWSTATE_columnClicked] = true;
                        columnIndex = nmlv.iSubItem;
                        break;
                    }

                case NativeMethods.LVN_ENDLABELEDITA:
                case NativeMethods.LVN_ENDLABELEDITW: {
                        listViewState[LISTVIEWSTATE_inLabelEdit] = false;
                        NativeMethods.NMLVDISPINFO nmlvdp = (NativeMethods.NMLVDISPINFO)m.GetLParam(typeof(NativeMethods.NMLVDISPINFO));
                        LabelEditEventArgs e = new LabelEditEventArgs(nmlvdp.item.iItem, nmlvdp.item.pszText);
                        OnAfterLabelEdit(e);
                        m.Result = (IntPtr)(e.CancelEdit ? 0 : 1);
                        // from msdn:
                        //   "If the user cancels editing, the pszText member of the LVITEM structure is NULL"
                        if (!e.CancelEdit && nmlvdp.item.pszText != null)
                            Items[nmlvdp.item.iItem].Text = nmlvdp.item.pszText;
                        break;
                    }

                case NativeMethods.LVN_ITEMACTIVATE:
                    OnItemActivate(EventArgs.Empty);
                    break;

                case NativeMethods.LVN_BEGINDRAG: {
                    // the items collection was modified while dragging
                    // that means that we can't reliably give the user the item on which the dragging started
                    // so don't tell the user about this operation...
                    // vsWhidbey 235027
                    if (!this.ItemCollectionChangedInMouseDown) {
                        NativeMethods.NMLISTVIEW nmlv = (NativeMethods.NMLISTVIEW)m.GetLParam(typeof(NativeMethods.NMLISTVIEW));
                        LvnBeginDrag(MouseButtons.Left, nmlv);
                    }

                    break;
                }

                case NativeMethods.LVN_BEGINRDRAG: {
                    // the items collection was modified while dragging
                    // that means that we can't reliably give the user the item on which the dragging started
                    // so don't tell the user about this operation...
                    // vsWhidbey 235027
                    if (!this.ItemCollectionChangedInMouseDown) {
                        NativeMethods.NMLISTVIEW nmlv = (NativeMethods.NMLISTVIEW)m.GetLParam(typeof(NativeMethods.NMLISTVIEW));
                        LvnBeginDrag(MouseButtons.Right, nmlv);
                    }
                    break;
                }


                case NativeMethods.LVN_ITEMCHANGING: {
                        NativeMethods.NMLISTVIEW* nmlv = (NativeMethods.NMLISTVIEW*)m.LParam;
                        if ((nmlv->uChanged & NativeMethods.LVIF_STATE) != 0) {
                            // Because the state image mask is 1-based, a value of 1 means unchecked,
                            // anything else means checked.  We convert this to the more standard 0 or 1
                            CheckState oldState = (CheckState)(((nmlv->uOldState & NativeMethods.LVIS_STATEIMAGEMASK) >> 12) == 1 ? 0 : 1);
                            CheckState newState = (CheckState)(((nmlv->uNewState & NativeMethods.LVIS_STATEIMAGEMASK) >> 12) == 1 ? 0 : 1);

                            if (oldState != newState) {
                                ItemCheckEventArgs e = new ItemCheckEventArgs(nmlv->iItem, newState, oldState);
                                OnItemCheck(e);
                                m.Result = (IntPtr)(((int)e.NewValue == 0 ? 0 : 1) == (int)oldState ? 1 : 0);
                            }
                        }
                        break;
                    }

                case NativeMethods.LVN_ITEMCHANGED: {
                        NativeMethods.NMLISTVIEW* nmlv = (NativeMethods.NMLISTVIEW*)m.LParam;
                        // Check for state changes to the selected state...
                        if ((nmlv->uChanged & NativeMethods.LVIF_STATE) != 0) {
                            // Because the state image mask is 1-based, a value of 1 means unchecked,
                            // anything else means checked.  We convert this to the more standard 0 or 1
                            CheckState oldValue = (CheckState)(((nmlv->uOldState & NativeMethods.LVIS_STATEIMAGEMASK) >> 12) == 1 ? 0 : 1);
                            CheckState newValue = (CheckState)(((nmlv->uNewState & NativeMethods.LVIS_STATEIMAGEMASK) >> 12) == 1 ? 0 : 1);

                            if (newValue != oldValue) {
                                ItemCheckedEventArgs e = new ItemCheckedEventArgs(Items[nmlv->iItem]);
                                OnItemChecked(e);
                            }

                            int oldState = nmlv->uOldState & NativeMethods.LVIS_SELECTED;
                            int newState = nmlv->uNewState & NativeMethods.LVIS_SELECTED;
                            // Windows common control always fires
                            // this event twice, once with newState, oldState, and again with
                            // oldState, newState.
                            // Changing this affects the behaviour as the control never
                            // fires the event on a Deselct of an Items from multiple selections.
                            // So leave it as it is...
                            if (newState != oldState) {
                                if (this.VirtualMode && nmlv->iItem == -1)
                                {
                                    if (this.VirtualListSize > 0) {
                                        ListViewVirtualItemsSelectionRangeChangedEventArgs lvvisrce = new ListViewVirtualItemsSelectionRangeChangedEventArgs(0, this.VirtualListSize-1, newState != 0);
                                        OnVirtualItemsSelectionRangeChanged(lvvisrce);
                                    }
                                }
                                else
                                {
                                    // APPCOMPAT
                                    // V1.* users implement virtualization by communicating directly to the native ListView and
                                    // by passing our virtualization implementation.
                                    // In that case, the native list view may have an item under the mouse even if our wrapper thinks the item count is 0.
                                    // And that may cause GetItemAt to throw an out of bounds exception.
                                    // See VSW 418791.

                                    if (this.Items.Count > 0) {
                                        ListViewItemSelectionChangedEventArgs lvisce = new ListViewItemSelectionChangedEventArgs(this.Items[nmlv->iItem],
                                                                                                                                 nmlv->iItem,
                                                                                                                                 newState != 0);
                                        OnItemSelectionChanged(lvisce);
                                    }
                                }
                                // VSWhidbey 549967 - Delay SelectedIndexChanged event because the last item isn't present yet.
                                if (this.Items.Count == 0 || this.Items[this.Items.Count - 1] != null)
                                {
                                    this.listViewState1[LISTVIEWSTATE1_selectedIndexChangedSkipped] = false;
                                    OnSelectedIndexChanged(EventArgs.Empty);
                                }
                                else
                                {
                                    this.listViewState1[LISTVIEWSTATE1_selectedIndexChangedSkipped] = true;
                                }
                            }
                        }
                        break;
                    }

                case NativeMethods.NM_CLICK:
                    WmNmClick(ref m);
                    // FALL THROUGH //
                    goto case NativeMethods.NM_RCLICK;

                case NativeMethods.NM_RCLICK:
                    NativeMethods.LVHITTESTINFO lvhi = new NativeMethods.LVHITTESTINFO();
                    int displayIndex = GetIndexOfClickedItem(lvhi);

                    MouseButtons button = nmhdr->code == NativeMethods.NM_CLICK ? MouseButtons.Left : MouseButtons.Right;
                    Point pos = Cursor.Position;
                    pos = PointToClientInternal(pos);

                    if (!ValidationCancelled && displayIndex != -1) {
                        OnClick(EventArgs.Empty);
                        OnMouseClick(new MouseEventArgs(button, 1, pos.X, pos.Y, 0));
                    }
                    if (!listViewState[LISTVIEWSTATE_mouseUpFired])
                    {
                        OnMouseUp(new MouseEventArgs(button, 1, pos.X, pos.Y, 0));
                        listViewState[LISTVIEWSTATE_mouseUpFired] = true;
                    }
                    break;

                case NativeMethods.NM_DBLCLK:
                    WmNmDblClick(ref m);
                    // FALL THROUGH //
                    goto case NativeMethods.NM_RDBLCLK;

                case NativeMethods.NM_RDBLCLK:
                    NativeMethods.LVHITTESTINFO lvhip = new NativeMethods.LVHITTESTINFO();
                    int index = GetIndexOfClickedItem(lvhip);

                    if (index != -1) {
                        //just maintain state and fire double click.. in final mouseUp...
                        listViewState[LISTVIEWSTATE_doubleclickFired] = true;
                    }
                    //fire Up in the Wndproc !!
                    listViewState[LISTVIEWSTATE_mouseUpFired] = false;
                    //problem getting the UP... outside the control...
                    //
                    CaptureInternal = true;
                    break;

                case NativeMethods.LVN_KEYDOWN:
                    if (CheckBoxes) {
                        NativeMethods.NMLVKEYDOWN lvkd = (NativeMethods.NMLVKEYDOWN)m.GetLParam(typeof(NativeMethods.NMLVKEYDOWN));
                        if (lvkd.wVKey == (short)Keys.Space) {
                            ListViewItem focusedItem = FocusedItem;
                            if (focusedItem != null) {
                                bool check = !focusedItem.Checked;
                                if (!VirtualMode) {
                                    foreach(ListViewItem item in SelectedItems) {
                                        if (item != focusedItem) {
                                            item.Checked = check;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    break;

                case NativeMethods.LVN_ODCACHEHINT:
                    // tell the user to prepare the cache:
                    NativeMethods.NMLVCACHEHINT cacheHint = (NativeMethods.NMLVCACHEHINT) m.GetLParam(typeof(NativeMethods.NMLVCACHEHINT));
                    OnCacheVirtualItems(new CacheVirtualItemsEventArgs(cacheHint.iFrom, cacheHint.iTo));
                    break;

                default:
                    if (nmhdr->code == NativeMethods.LVN_GETDISPINFO) {
                        // we use the LVN_GETDISPINFO message only in virtual mode
                        if (this.VirtualMode && m.LParam != IntPtr.Zero) {
                            // we HAVE to use unsafe code because of a bug in the CLR: WHIDBEY bug 20313
                            NativeMethods.NMLVDISPINFO_NOTEXT dispInfo= (NativeMethods.NMLVDISPINFO_NOTEXT) m.GetLParam(typeof(NativeMethods.NMLVDISPINFO_NOTEXT));

                            RetrieveVirtualItemEventArgs rVI = new RetrieveVirtualItemEventArgs(dispInfo.item.iItem);
                            OnRetrieveVirtualItem(rVI);
                            ListViewItem lvItem = rVI.Item;
                            if (lvItem == null)
                            {
                                throw new InvalidOperationException(SR.GetString(SR.ListViewVirtualItemRequired));
                            }

                            lvItem.SetItemIndex(this, dispInfo.item.iItem);
                            if ((dispInfo.item.mask & NativeMethods.LVIF_TEXT) != 0) {
                                string text;
                                if (dispInfo.item.iSubItem == 0) {
                                    text = lvItem.Text;                                         // we want the item
                                }
                                else {
                                    if (lvItem.SubItems.Count <= dispInfo.item.iSubItem) {
                                        throw new InvalidOperationException(SR.GetString(SR.ListViewVirtualModeCantAccessSubItem));
                                    }
                                    else {
                                        text = lvItem.SubItems[dispInfo.item.iSubItem].Text;            // we want the sub item
                                    }
                                }

                                // use the buffer provided by the ComCtrl list view.
                                if (dispInfo.item.cchTextMax <= text.Length) {
                                    text = text.Substring(0, dispInfo.item.cchTextMax - 1);
                                }

                                if (Marshal.SystemDefaultCharSize == 1) {
                                    // ANSI. Use byte
                                    byte[] buff = System.Text.Encoding.Default.GetBytes(text + "\0");
                                    Marshal.Copy(buff, 0, dispInfo.item.pszText, text.Length + 1);
                                } else {
                                    char[] buff = (text + "\0").ToCharArray();
                                    Marshal.Copy(buff, 0, dispInfo.item.pszText, text.Length + 1);
                                }
                            }

                            if ((dispInfo.item.mask & NativeMethods.LVIF_IMAGE) != 0 && lvItem.ImageIndex != -1) {
                                dispInfo.item.iImage = lvItem.ImageIndex;
                            }

                            if ((dispInfo.item.mask & NativeMethods.LVIF_INDENT) != 0) {
                                dispInfo.item.iIndent = lvItem.IndentCount;
                            }

                            /* [....]: Couldn't make this work. The dispInfo.item.iSubItem received for the subitems' text
                                       are invalid
                            if ((dispInfo.item.mask & NativeMethods.LVIF_COLUMNS) != 0) {
                                int cColumns = this.columnHeaders != null ? this.columnHeaders.Length : 0;
                                dispInfo.item.cColumns = cColumns;
                                if (cColumns > 0) {
                                    dispInfo.item.puColumns = Marshal.AllocHGlobal(cColumns * Marshal.SizeOf(typeof(int)));
                                    int[] columns = new int[cColumns];
                                    for (int c = 0; c < cColumns; c++) {
                                        columns[c] = c + 1;
                                    }
                                    Marshal.Copy(columns, 0, dispInfo.item.puColumns, cColumns);
                                }
                            }
                            */

                            /* [....]: VirtualMode and grouping seem to be incompatible.
                                       dispInfo.item.mask never includes NativeMethods.LVIF_GROUPID.
                                       Besides, trying to send LVM_ENABLEGROUPVIEW to the listview fails in virtual mode.
                            if (this.GroupsEnabled && (dispInfo.item.mask & NativeMethods.LVIF_GROUPID) != 0)
                            {
                                dispInfo.item.iGroupId = GetNativeGroupId(lvItem);
                                #if DEBUG
                                    Debug.Assert(SendMessage(NativeMethods.LVM_ISGROUPVIEWENABLED, 0, 0) != IntPtr.Zero, "Groups not enabled");
                                    Debug.Assert(SendMessage(NativeMethods.LVM_HASGROUP, dispInfo.item.iGroupId, 0) != IntPtr.Zero, "Doesn't contain group id: " + dispInfo.item.iGroupId.ToString(CultureInfo.InvariantCulture));
                                #endif
                            }
                            */

                            if ((dispInfo.item.stateMask & NativeMethods.LVIS_STATEIMAGEMASK) != 0) {
                                dispInfo.item.state |= lvItem.RawStateImageIndex;
                            }
                            Marshal.StructureToPtr(dispInfo, (IntPtr) m.LParam, false);

                        }
                    }
                    else if (nmhdr->code == NativeMethods.LVN_ODSTATECHANGED) {
                        if (VirtualMode && m.LParam != IntPtr.Zero) {
                            NativeMethods.NMLVODSTATECHANGE odStateChange = (NativeMethods.NMLVODSTATECHANGE) m.GetLParam(typeof(NativeMethods.NMLVODSTATECHANGE));
                            bool selectedChanged = (odStateChange.uNewState & NativeMethods.LVIS_SELECTED) != (odStateChange.uOldState & NativeMethods.LVIS_SELECTED);
                            if (selectedChanged) {
                                // we have to substract 1 from iTo due to an imbecility in the win32 ListView control
                                // see vsWhidbey 275717 - especially the ListView_CalcMinMaxIndex method.
                                // in Vista, 275717 is fixed in windows OS side, we have don't need to work around here any more.
                                int iTo = odStateChange.iTo;
                                if (!UnsafeNativeMethods.IsVista) {
                                    iTo--;
                                }
                                ListViewVirtualItemsSelectionRangeChangedEventArgs lvvisrce = new ListViewVirtualItemsSelectionRangeChangedEventArgs(odStateChange.iFrom, iTo, (odStateChange.uNewState & NativeMethods.LVIS_SELECTED) != 0);
                                OnVirtualItemsSelectionRangeChanged(lvvisrce);
                            }
                        }
                    }
                    else if (nmhdr->code == NativeMethods.LVN_GETINFOTIP) {
                        if (ShowItemToolTips && m.LParam != IntPtr.Zero) {
                            NativeMethods.NMLVGETINFOTIP infoTip = (NativeMethods.NMLVGETINFOTIP) m.GetLParam(typeof(NativeMethods.NMLVGETINFOTIP));
                            ListViewItem lvi = Items[infoTip.item];
                            if (lvi != null && !string.IsNullOrEmpty(lvi.ToolTipText)) {

                                // MSDN:
                                // Setting the max width has the added benefit of enabling multiline
                                // tool tips!
                                //
                                
                                UnsafeNativeMethods.SendMessage(new HandleRef(this, nmhdr->hwndFrom), NativeMethods.TTM_SETMAXTIPWIDTH, 0, SystemInformation.MaxWindowTrackSize.Width);

                                if (Marshal.SystemDefaultCharSize == 1) {
                                    // ANSI. Use byte.
                                    // we need to copy the null terminator character ourselves
                                    byte[] byteBuf = System.Text.Encoding.Default.GetBytes(lvi.ToolTipText + "\0");
                                    Marshal.Copy(byteBuf, 0, infoTip.lpszText, Math.Min(byteBuf.Length, infoTip.cchTextMax));
                                } else {
                                    // UNICODE. Use char.
                                    // we need to copy the null terminator character ourselves
                                    char[] charBuf = (lvi.ToolTipText + "\0").ToCharArray();
                                    Marshal.Copy(charBuf, 0, infoTip.lpszText, Math.Min(charBuf.Length, infoTip.cchTextMax));
                                }
                                Marshal.StructureToPtr(infoTip, (IntPtr) m.LParam, false);
                            }
                        }
                    }
                    else if (nmhdr->code == NativeMethods.LVN_ODFINDITEM) {
                        if (VirtualMode) {
                            NativeMethods.NMLVFINDITEM nmlvif = (NativeMethods.NMLVFINDITEM) m.GetLParam(typeof(NativeMethods.NMLVFINDITEM));

                            if ((nmlvif.lvfi.flags & NativeMethods.LVFI_PARAM) != 0) {
                                m.Result = (IntPtr) (-1);
                                return;
                            }

                            bool isTextSearch = ((nmlvif.lvfi.flags & NativeMethods.LVFI_STRING) != 0) ||
                                                ((nmlvif.lvfi.flags & NativeMethods.LVFI_PARTIAL) != 0);

                            bool isPrefixSearch = (nmlvif.lvfi.flags & NativeMethods.LVFI_PARTIAL) != 0;

                            string text = String.Empty;
                            if (isTextSearch) {
                                text = nmlvif.lvfi.psz;
                            }

                            Point startingPoint = Point.Empty;
                            if ((nmlvif.lvfi.flags & NativeMethods.LVFI_NEARESTXY) != 0) {
                                startingPoint = new Point(nmlvif.lvfi.ptX, nmlvif.lvfi.ptY);
                            }

                            SearchDirectionHint dir = SearchDirectionHint.Down;
                            if ((nmlvif.lvfi.flags & NativeMethods.LVFI_NEARESTXY) != 0) {
                                // We can do this because SearchDirectionHint is set to the VK_*
                                dir = (SearchDirectionHint) nmlvif.lvfi.vkDirection;
                            }

                            int startIndex = nmlvif.iStart;
                            if (startIndex >= this.VirtualListSize) {
                                // we want to search starting from the last item. Wrap around the first item.
                                startIndex = 0;
                            }


                            SearchForVirtualItemEventArgs sviEvent = new SearchForVirtualItemEventArgs(
                                                                         isTextSearch,
                                                                         isPrefixSearch,
                                                                         false, /* includeSubItemsInSearch */
                                                                         text,
                                                                         startingPoint,
                                                                         dir,
                                                                         nmlvif.iStart);

                            OnSearchForVirtualItem(sviEvent);
                            if (sviEvent.Index != -1) {
                                m.Result = (IntPtr) sviEvent.Index;
                            } else {
                                m.Result = (IntPtr) (-1);
                            }
                        }
                    }
                break;
            }
        }
Esempio n. 8
0
        private void PreviewListView_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e)
        {
            // Keep track of what image/s are selected.
            ListView.SelectedIndexCollection _col = PreviewListView.SelectedIndices;

            if (_col.Count > 1)
            {
                toolStripStatusLabel.ForeColor = Color.Red;
                toolStripStatusLabel.Text = "Multiple images selected.";
            }
        }
Esempio n. 9
0
        private void listView_browse_VirtualItemsSelectionRangeChanged(object sender,
            ListViewVirtualItemsSelectionRangeChangedEventArgs e)
        {
            ZConnection connection = this.GetCurrentZConnection();
            if (connection != null)
                SaveListViewSelectedToVirtual(connection);

            // 需要补发SelectedChanged消息。否则,后到来的本消息,不会促使菜单和工具条按钮状态发生变化
            listView_browse_SelectedIndexChanged(null, null);

#if NOOOOOOOOOOOOOOOO

            if (e.IsSelected == false)
            {
                /*
                if (e.StartIndex == 0
                    && e.EndIndex == 0)
                {
                    Debug.Assert(this.listView_browse.VirtualListSize
                    == this.CurrentBrowseItems.Count, "");
                    for (int i = 0; i < this.listView_browse.VirtualListSize; i++)
                        this.CurrentBrowseItems[i].Selected = false;
                }
                else
                {*/
                    for (int i = e.StartIndex; i <= e.EndIndex; i++)
                        this.CurrentBrowseItems[i].Selected = false;
                // }
            }
            else
            {
                /*
                if (e.StartIndex == 0
                    && e.EndIndex == 0)
                {
                    Debug.Assert(this.listView_browse.VirtualListSize
                    == this.CurrentBrowseItems.Count, "");

                    for (int i = 0; i < this.listView_browse.VirtualListSize; i++)
                        this.CurrentBrowseItems[i].Selected = true;
                }
                else
                {*/
                    for (int i = e.StartIndex; i <= e.EndIndex; i++)
                        this.CurrentBrowseItems[i].Selected = true;
                // }
            }
#endif
        }
Esempio n. 10
0
 private void listSSA_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e)
 {
     int end = (e.EndIndex == lineColl.Count) ? lineColl.Count : e.EndIndex + 1;
     for (int index = 0; index != lineColl.Count; index+=1)
         lineColl[index].selected = (index >= e.StartIndex && index <= end) ? e.IsSelected : !e.IsSelected;
 }
        protected override void OnVirtualItemsSelectionRangeChanged(ListViewVirtualItemsSelectionRangeChangedEventArgs e)
        {
            base.OnVirtualItemsSelectionRangeChanged(e);

            ///UpdateColumnWidths();
        }
Esempio n. 12
0
 private void lvReport_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e)
 {
     this.cmRengeCheck.Enabled = this.ReportSelectedItems().Count > 0;
     this.cmRengeCheckCancel.Enabled = this.cmRengeCheck.Enabled;
 }
Esempio n. 13
0
		private void listViewFiles_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e)
		{
			if (e.IsSelected)
				mSelectedItem = mFilteredItems[e.StartIndex];
			else
				mSelectedItem = null;
		}
Esempio n. 14
0
 private void log_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e)
 {
     for (int i = e.StartIndex; i <= e.EndIndex; ++i)
        {
     if (e.IsSelected)
     {
      SelectedEntries.Add(i, EntryCache[i]);
     }
     else
     {
      SelectedEntries.Remove(i);
     }
        }
 }
Esempio n. 15
0
 private void listViewLogMessages_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e)
 {
 }
Esempio n. 16
0
 private void LvEventsOnVirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs listViewVirtualItemsSelectionRangeChangedEventArgs)
 {
     UpdateSourceBox();
 }
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// listviewvirtualitemsselectionrangechangedeventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this ListViewVirtualItemsSelectionRangeChangedEventHandler listviewvirtualitemsselectionrangechangedeventhandler, Object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e, AsyncCallback callback)
        {
            if(listviewvirtualitemsselectionrangechangedeventhandler == null) throw new ArgumentNullException("listviewvirtualitemsselectionrangechangedeventhandler");

            return listviewvirtualitemsselectionrangechangedeventhandler.BeginInvoke(sender, e, callback, null);
        }
Esempio n. 18
0
 /// <include file='doc\ListView.uex' path='docs/doc[@for="ListView.OnVirtualItemSelectionRangeChanged"]/*' />
 protected virtual void OnVirtualItemsSelectionRangeChanged(ListViewVirtualItemsSelectionRangeChangedEventArgs e) {
     ListViewVirtualItemsSelectionRangeChangedEventHandler eh = (ListViewVirtualItemsSelectionRangeChangedEventHandler) Events[EVENT_VIRTUALITEMSSELECTIONRANGECHANGED];
     if (eh != null)
         eh(this, e);
 }
 void listView_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e)
 {
 }
Esempio n. 20
0
 private void log_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e)
 {
     for (int i = e.StartIndex; i <= e.EndIndex; ++i)
        {
     if (e.IsSelected)
     {
      if (!selectedEntries.ContainsKey(i))
       selectedEntries.Add(i, null);
     }
     else
     {
      selectedEntries.Remove(i);
     }
        }
 }
 private void listView1_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e)
 {
     bool singleSelection = e.EndIndex == e.StartIndex;
     this.buttonDown.Enabled = singleSelection;
     this.buttonUp.Enabled = singleSelection;
 }
 private void annotationsListView_VirtualItemsSelectionRangeChanged( object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e )
 {
     annotationsListView_SelectedIndexChanged( sender, e );
 }
		public void TestListViewVirtualItemsSelectionRangeChangedEventArgs ()
		{
			bool selected = false;
			int start = 3;
			int end = 76;

			ListViewVirtualItemsSelectionRangeChangedEventArgs e = new ListViewVirtualItemsSelectionRangeChangedEventArgs (start, end, selected);

			Assert.AreEqual (selected, e.IsSelected, "A1");
			Assert.AreEqual (start, e.StartIndex, "A2");
			Assert.AreEqual (end, e.EndIndex, "A3");
		}
Esempio n. 24
0
			private void ItemsMouseDown (object sender, MouseEventArgs me)
			{
				owner.OnMouseDown (owner.TranslateMouseEventArgs (me));
				if (owner.items.Count == 0)
					return;

				bool box_selecting = false;
				Size item_size = owner.ItemSize;
				Point pt = new Point (me.X, me.Y);
				for (int i = 0; i < owner.items.Count; i++) {
					Rectangle item_rect = new Rectangle (owner.GetItemLocation (i), item_size);
					if (!item_rect.Contains (pt))
						continue;

					// Actual item in 'i' position
					ListViewItem item = owner.GetItemAtDisplayIndex (i);

					if (item.CheckRectReal.Contains (pt)) {
						// Don't modify check state if we have only one image
						// and if we are in 1.1 profile only take into account
						// double clicks
						if (owner.StateImageList != null && owner.StateImageList.Images.Count < 2 
								)
							return;

						// Generate an extra ItemCheck event when we got two clicks
						// (Match weird .Net behaviour)
						if (me.Clicks == 2)
							item.Checked = !item.Checked;

						item.Checked = !item.Checked;
						checking = true;
						return;
					}
					
					if (owner.View == View.Details) {
						bool over_text = item.TextBounds.Contains (pt);
						if (owner.FullRowSelect) {
							clicked_item = item;
							bool over_item_column = (me.X > owner.Columns[0].X && me.X < owner.Columns[0].X + owner.Columns[0].Width);
							if (!over_text && over_item_column && owner.MultiSelect)
								box_selecting = true;
						} else if (over_text)
							clicked_item = item;
						else
							owner.SetFocusedItem (i);
					} else
						clicked_item = item;

					break;
				}


				if (clicked_item != null) {
					bool changed = !clicked_item.Selected;
					if (me.Button == MouseButtons.Left || (XplatUI.State.ModifierKeys == Keys.None && changed))
						owner.SetFocusedItem (clicked_item.DisplayIndex);

					if (owner.MultiSelect) {
						bool reselect = (!owner.LabelEdit || changed);
						if (me.Button == MouseButtons.Left || (XplatUI.State.ModifierKeys == Keys.None && changed))
							owner.UpdateMultiSelection (clicked_item.DisplayIndex, reselect);
					} else {
						clicked_item.Selected = true;
					}

					if (owner.VirtualMode && changed) {
						// Broken event - It's not fired from Item.Selected also
						ListViewVirtualItemsSelectionRangeChangedEventArgs args = 
							new ListViewVirtualItemsSelectionRangeChangedEventArgs (0, owner.items.Count - 1, false);

						owner.OnVirtualItemsSelectionRangeChanged (args);
					}
					// Report clicks only if the item was clicked. On MS the
					// clicks are only raised if you click an item
					clicks = me.Clicks;
					if (me.Clicks > 1) {
						if (owner.CheckBoxes)
							clicked_item.Checked = !clicked_item.Checked;
					} else if (me.Clicks == 1) {
						if (owner.LabelEdit && !changed)
							BeginEdit (clicked_item); // this is probably not the correct place to execute BeginEdit
					}

					drag_begin = me.Location;
					dragged_item_index = clicked_item.Index;
				} else {
					if (owner.MultiSelect)
						box_selecting = true;
					else if (owner.SelectedItems.Count > 0)
						owner.SelectedItems.Clear ();
				}

				if (box_selecting) {
					Keys mods = XplatUI.State.ModifierKeys;
					if ((mods & Keys.Shift) != 0)
						box_select_mode = BoxSelect.Shift;
					else if ((mods & Keys.Control) != 0)
						box_select_mode = BoxSelect.Control;
					else
						box_select_mode = BoxSelect.Normal;
					box_select_start = pt; 
					prev_selection = owner.SelectedIndices.List.Clone () as IList;
				}
			}
 protected virtual void OnVirtualItemsSelectionRangeChanged(ListViewVirtualItemsSelectionRangeChangedEventArgs e)
 {
     ListViewVirtualItemsSelectionRangeChangedEventHandler handler = (ListViewVirtualItemsSelectionRangeChangedEventHandler) base.Events[EVENT_VIRTUALITEMSSELECTIONRANGECHANGED];
     if (handler != null)
     {
         handler(this, e);
     }
 }
Esempio n. 26
0
 private void lstInvoices_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e)
 {
 }
        private unsafe void WmReflectNotify(ref Message m)
        {
            System.Windows.Forms.NativeMethods.LVHITTESTINFO lvhittestinfo2;
            System.Windows.Forms.NativeMethods.NMHDR* lParam = (System.Windows.Forms.NativeMethods.NMHDR*) m.LParam;
            switch (lParam->code)
            {
                case -176:
                case -106:
                {
                    this.listViewState[0x4000] = false;
                    System.Windows.Forms.NativeMethods.NMLVDISPINFO nmlvdispinfo = (System.Windows.Forms.NativeMethods.NMLVDISPINFO) m.GetLParam(typeof(System.Windows.Forms.NativeMethods.NMLVDISPINFO));
                    LabelEditEventArgs e = new LabelEditEventArgs(nmlvdispinfo.item.iItem, nmlvdispinfo.item.pszText);
                    this.OnAfterLabelEdit(e);
                    m.Result = e.CancelEdit ? IntPtr.Zero : ((IntPtr) 1);
                    if (!e.CancelEdit && (nmlvdispinfo.item.pszText != null))
                    {
                        this.Items[nmlvdispinfo.item.iItem].Text = nmlvdispinfo.item.pszText;
                    }
                    return;
                }
                case -175:
                case -105:
                {
                    System.Windows.Forms.NativeMethods.NMLVDISPINFO_NOTEXT nmlvdispinfo_notext = (System.Windows.Forms.NativeMethods.NMLVDISPINFO_NOTEXT) m.GetLParam(typeof(System.Windows.Forms.NativeMethods.NMLVDISPINFO_NOTEXT));
                    LabelEditEventArgs args = new LabelEditEventArgs(nmlvdispinfo_notext.item.iItem);
                    this.OnBeforeLabelEdit(args);
                    m.Result = args.CancelEdit ? ((IntPtr) 1) : IntPtr.Zero;
                    this.listViewState[0x4000] = !args.CancelEdit;
                    return;
                }
                case -155:
                    if (this.CheckBoxes)
                    {
                        System.Windows.Forms.NativeMethods.NMLVKEYDOWN nmlvkeydown = (System.Windows.Forms.NativeMethods.NMLVKEYDOWN) m.GetLParam(typeof(System.Windows.Forms.NativeMethods.NMLVKEYDOWN));
                        if (nmlvkeydown.wVKey == 0x20)
                        {
                            ListViewItem focusedItem = this.FocusedItem;
                            if (focusedItem != null)
                            {
                                bool flag = !focusedItem.Checked;
                                if (!this.VirtualMode)
                                {
                                    foreach (ListViewItem item2 in this.SelectedItems)
                                    {
                                        if (item2 != focusedItem)
                                        {
                                            item2.Checked = flag;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    return;

                case -114:
                    this.OnItemActivate(EventArgs.Empty);
                    return;

                case -113:
                {
                    System.Windows.Forms.NativeMethods.NMLVCACHEHINT nmlvcachehint = (System.Windows.Forms.NativeMethods.NMLVCACHEHINT) m.GetLParam(typeof(System.Windows.Forms.NativeMethods.NMLVCACHEHINT));
                    this.OnCacheVirtualItems(new CacheVirtualItemsEventArgs(nmlvcachehint.iFrom, nmlvcachehint.iTo));
                    return;
                }
                case -111:
                    if (!this.ItemCollectionChangedInMouseDown)
                    {
                        System.Windows.Forms.NativeMethods.NMLISTVIEW nmlv = (System.Windows.Forms.NativeMethods.NMLISTVIEW) m.GetLParam(typeof(System.Windows.Forms.NativeMethods.NMLISTVIEW));
                        this.LvnBeginDrag(MouseButtons.Right, nmlv);
                    }
                    return;

                case -109:
                    if (!this.ItemCollectionChangedInMouseDown)
                    {
                        System.Windows.Forms.NativeMethods.NMLISTVIEW nmlistview2 = (System.Windows.Forms.NativeMethods.NMLISTVIEW) m.GetLParam(typeof(System.Windows.Forms.NativeMethods.NMLISTVIEW));
                        this.LvnBeginDrag(MouseButtons.Left, nmlistview2);
                    }
                    return;

                case -108:
                {
                    System.Windows.Forms.NativeMethods.NMLISTVIEW nmlistview = (System.Windows.Forms.NativeMethods.NMLISTVIEW) m.GetLParam(typeof(System.Windows.Forms.NativeMethods.NMLISTVIEW));
                    this.listViewState[0x20000] = true;
                    this.columnIndex = nmlistview.iSubItem;
                    return;
                }
                case -101:
                {
                    System.Windows.Forms.NativeMethods.NMLISTVIEW* nmlistviewPtr2 = (System.Windows.Forms.NativeMethods.NMLISTVIEW*) m.LParam;
                    if ((nmlistviewPtr2->uChanged & 8) != 0)
                    {
                        CheckState state3 = (((nmlistviewPtr2->uOldState & 0xf000) >> 12) == 1) ? CheckState.Unchecked : CheckState.Checked;
                        CheckState state4 = (((nmlistviewPtr2->uNewState & 0xf000) >> 12) == 1) ? CheckState.Unchecked : CheckState.Checked;
                        if (state4 != state3)
                        {
                            ItemCheckedEventArgs args4 = new ItemCheckedEventArgs(this.Items[nmlistviewPtr2->iItem]);
                            this.OnItemChecked(args4);
                        }
                        int num = nmlistviewPtr2->uOldState & 2;
                        int num2 = nmlistviewPtr2->uNewState & 2;
                        if (num2 == num)
                        {
                            return;
                        }
                        if (this.VirtualMode && (nmlistviewPtr2->iItem == -1))
                        {
                            if (this.VirtualListSize > 0)
                            {
                                ListViewVirtualItemsSelectionRangeChangedEventArgs args5 = new ListViewVirtualItemsSelectionRangeChangedEventArgs(0, this.VirtualListSize - 1, num2 != 0);
                                this.OnVirtualItemsSelectionRangeChanged(args5);
                            }
                        }
                        else if (this.Items.Count > 0)
                        {
                            ListViewItemSelectionChangedEventArgs args6 = new ListViewItemSelectionChangedEventArgs(this.Items[nmlistviewPtr2->iItem], nmlistviewPtr2->iItem, num2 != 0);
                            this.OnItemSelectionChanged(args6);
                        }
                        if ((this.Items.Count == 0) || (this.Items[this.Items.Count - 1] != null))
                        {
                            this.listViewState1[0x10] = false;
                            this.OnSelectedIndexChanged(EventArgs.Empty);
                            return;
                        }
                        this.listViewState1[0x10] = true;
                    }
                    return;
                }
                case -100:
                {
                    System.Windows.Forms.NativeMethods.NMLISTVIEW* nmlistviewPtr = (System.Windows.Forms.NativeMethods.NMLISTVIEW*) m.LParam;
                    if ((nmlistviewPtr->uChanged & 8) != 0)
                    {
                        CheckState currentValue = (((nmlistviewPtr->uOldState & 0xf000) >> 12) == 1) ? CheckState.Unchecked : CheckState.Checked;
                        CheckState newCheckValue = (((nmlistviewPtr->uNewState & 0xf000) >> 12) == 1) ? CheckState.Unchecked : CheckState.Checked;
                        if (currentValue == newCheckValue)
                        {
                            return;
                        }
                        ItemCheckEventArgs ice = new ItemCheckEventArgs(nmlistviewPtr->iItem, newCheckValue, currentValue);
                        this.OnItemCheck(ice);
                        m.Result = (((ice.NewValue == CheckState.Unchecked) ? CheckState.Unchecked : CheckState.Checked) == currentValue) ? ((IntPtr) 1) : IntPtr.Zero;
                    }
                    return;
                }
                case -12:
                    this.CustomDraw(ref m);
                    return;

                case -6:
                    goto Label_0517;

                case -5:
                    break;

                case -3:
                    this.WmNmDblClick(ref m);
                    goto Label_0517;

                case -2:
                    this.WmNmClick(ref m);
                    break;

                default:
                    if (lParam->code == System.Windows.Forms.NativeMethods.LVN_GETDISPINFO)
                    {
                        if (this.VirtualMode && (m.LParam != IntPtr.Zero))
                        {
                            System.Windows.Forms.NativeMethods.NMLVDISPINFO_NOTEXT structure = (System.Windows.Forms.NativeMethods.NMLVDISPINFO_NOTEXT) m.GetLParam(typeof(System.Windows.Forms.NativeMethods.NMLVDISPINFO_NOTEXT));
                            RetrieveVirtualItemEventArgs args7 = new RetrieveVirtualItemEventArgs(structure.item.iItem);
                            this.OnRetrieveVirtualItem(args7);
                            ListViewItem item = args7.Item;
                            if (item == null)
                            {
                                throw new InvalidOperationException(System.Windows.Forms.SR.GetString("ListViewVirtualItemRequired"));
                            }
                            item.SetItemIndex(this, structure.item.iItem);
                            if ((structure.item.mask & 1) != 0)
                            {
                                string text;
                                if (structure.item.iSubItem == 0)
                                {
                                    text = item.Text;
                                }
                                else
                                {
                                    if (item.SubItems.Count <= structure.item.iSubItem)
                                    {
                                        throw new InvalidOperationException(System.Windows.Forms.SR.GetString("ListViewVirtualModeCantAccessSubItem"));
                                    }
                                    text = item.SubItems[structure.item.iSubItem].Text;
                                }
                                if (structure.item.cchTextMax <= text.Length)
                                {
                                    text = text.Substring(0, structure.item.cchTextMax - 1);
                                }
                                if (Marshal.SystemDefaultCharSize == 1)
                                {
                                    Marshal.Copy(Encoding.Default.GetBytes(text + "\0"), 0, structure.item.pszText, text.Length + 1);
                                }
                                else
                                {
                                    Marshal.Copy((text + "\0").ToCharArray(), 0, structure.item.pszText, text.Length + 1);
                                }
                            }
                            if (((structure.item.mask & 2) != 0) && (item.ImageIndex != -1))
                            {
                                structure.item.iImage = item.ImageIndex;
                            }
                            if ((structure.item.mask & 0x10) != 0)
                            {
                                structure.item.iIndent = item.IndentCount;
                            }
                            if ((structure.item.stateMask & 0xf000) != 0)
                            {
                                structure.item.state |= item.RawStateImageIndex;
                            }
                            Marshal.StructureToPtr(structure, m.LParam, false);
                            return;
                        }
                    }
                    else if (lParam->code == -115)
                    {
                        if (this.VirtualMode && (m.LParam != IntPtr.Zero))
                        {
                            System.Windows.Forms.NativeMethods.NMLVODSTATECHANGE nmlvodstatechange = (System.Windows.Forms.NativeMethods.NMLVODSTATECHANGE) m.GetLParam(typeof(System.Windows.Forms.NativeMethods.NMLVODSTATECHANGE));
                            if ((nmlvodstatechange.uNewState & 2) != (nmlvodstatechange.uOldState & 2))
                            {
                                ListViewVirtualItemsSelectionRangeChangedEventArgs args8 = new ListViewVirtualItemsSelectionRangeChangedEventArgs(nmlvodstatechange.iFrom, nmlvodstatechange.iTo - 1, (nmlvodstatechange.uNewState & 2) != 0);
                                this.OnVirtualItemsSelectionRangeChanged(args8);
                                return;
                            }
                        }
                    }
                    else if (lParam->code == System.Windows.Forms.NativeMethods.LVN_GETINFOTIP)
                    {
                        if (this.ShowItemToolTips && (m.LParam != IntPtr.Zero))
                        {
                            System.Windows.Forms.NativeMethods.NMLVGETINFOTIP nmlvgetinfotip = (System.Windows.Forms.NativeMethods.NMLVGETINFOTIP) m.GetLParam(typeof(System.Windows.Forms.NativeMethods.NMLVGETINFOTIP));
                            ListViewItem item4 = this.Items[nmlvgetinfotip.item];
                            if ((item4 != null) && !string.IsNullOrEmpty(item4.ToolTipText))
                            {
                                System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, lParam->hwndFrom), 0x418, 0, SystemInformation.MaxWindowTrackSize.Width);
                                if (Marshal.SystemDefaultCharSize == 1)
                                {
                                    byte[] bytes = Encoding.Default.GetBytes(item4.ToolTipText + "\0");
                                    Marshal.Copy(bytes, 0, nmlvgetinfotip.lpszText, Math.Min(bytes.Length, nmlvgetinfotip.cchTextMax));
                                }
                                else
                                {
                                    char[] source = (item4.ToolTipText + "\0").ToCharArray();
                                    Marshal.Copy(source, 0, nmlvgetinfotip.lpszText, Math.Min(source.Length, nmlvgetinfotip.cchTextMax));
                                }
                                Marshal.StructureToPtr(nmlvgetinfotip, m.LParam, false);
                                return;
                            }
                        }
                    }
                    else if ((lParam->code == System.Windows.Forms.NativeMethods.LVN_ODFINDITEM) && this.VirtualMode)
                    {
                        System.Windows.Forms.NativeMethods.NMLVFINDITEM nmlvfinditem = (System.Windows.Forms.NativeMethods.NMLVFINDITEM) m.GetLParam(typeof(System.Windows.Forms.NativeMethods.NMLVFINDITEM));
                        if ((nmlvfinditem.lvfi.flags & 1) != 0)
                        {
                            m.Result = (IntPtr) (-1);
                            return;
                        }
                        bool isTextSearch = ((nmlvfinditem.lvfi.flags & 2) != 0) || ((nmlvfinditem.lvfi.flags & 8) != 0);
                        bool isPrefixSearch = (nmlvfinditem.lvfi.flags & 8) != 0;
                        string psz = string.Empty;
                        if (isTextSearch)
                        {
                            psz = nmlvfinditem.lvfi.psz;
                        }
                        Point empty = Point.Empty;
                        if ((nmlvfinditem.lvfi.flags & 0x40) != 0)
                        {
                            empty = new Point(nmlvfinditem.lvfi.ptX, nmlvfinditem.lvfi.ptY);
                        }
                        SearchDirectionHint down = SearchDirectionHint.Down;
                        if ((nmlvfinditem.lvfi.flags & 0x40) != 0)
                        {
                            down = (SearchDirectionHint) nmlvfinditem.lvfi.vkDirection;
                        }
                        if (nmlvfinditem.iStart >= this.VirtualListSize)
                        {
                        }
                        SearchForVirtualItemEventArgs args9 = new SearchForVirtualItemEventArgs(isTextSearch, isPrefixSearch, false, psz, empty, down, nmlvfinditem.iStart);
                        this.OnSearchForVirtualItem(args9);
                        if (args9.Index != -1)
                        {
                            m.Result = (IntPtr) args9.Index;
                            return;
                        }
                        m.Result = (IntPtr) (-1);
                    }
                    return;
            }
            System.Windows.Forms.NativeMethods.LVHITTESTINFO lvhi = new System.Windows.Forms.NativeMethods.LVHITTESTINFO();
            int indexOfClickedItem = this.GetIndexOfClickedItem(lvhi);
            MouseButtons button = (lParam->code == -2) ? MouseButtons.Left : MouseButtons.Right;
            Point position = Cursor.Position;
            position = base.PointToClientInternal(position);
            if (!base.ValidationCancelled && (indexOfClickedItem != -1))
            {
                this.OnClick(EventArgs.Empty);
                this.OnMouseClick(new MouseEventArgs(button, 1, position.X, position.Y, 0));
            }
            if (!this.listViewState[0x80000])
            {
                this.OnMouseUp(new MouseEventArgs(button, 1, position.X, position.Y, 0));
                this.listViewState[0x80000] = true;
            }
            return;
        Label_0517:
            lvhittestinfo2 = new System.Windows.Forms.NativeMethods.LVHITTESTINFO();
            if (this.GetIndexOfClickedItem(lvhittestinfo2) != -1)
            {
                this.listViewState[0x40000] = true;
            }
            this.listViewState[0x80000] = false;
            base.CaptureInternal = true;
        }
Esempio n. 28
0
        private void listViewSessions_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e)
        {
            int end = (e.EndIndex + 2 <= m_SessionViewItems.Count) ? e.EndIndex + 2 : m_SessionViewItems.Count;

            lock (m_SessionViewItems)
            {
                for (int i = e.StartIndex; i < end; i++)
                {
                    m_SessionViewItems[i].Selected = e.IsSelected;
                }
            }

            ClearCache();
            listViewSessions.Invalidate();
        }
Esempio n. 29
0
 protected virtual void OnVirtualItemsSelectionRangeChanged(ListViewVirtualItemsSelectionRangeChangedEventArgs e)
 {
     throw null;
 }