Ejemplo n.º 1
0
        public GenericListViewSorter(ListView handleListView, GetCompareValue GetCompareRoutine)
        {
            OurListView = handleListView;

            if (GetCompareRoutine != null)
            {
                CompareValueFunc = GetCompareRoutine;
            }
            else
            {
                CompareValueFunc = GetCompareValue_Default;
            }

            handleListView.ColumnClick += new ColumnClickEventHandler(handleListView_ColumnClick);

            //other checks, for headers and whatnot.

            if (handleListView.ContextMenuStrip == null)
            {
                //if it is null, make a new one and add some items to it. We need the Opening Event to fire.
                handleListView.ContextMenuStrip = new ContextMenuStrip();
                handleListView.ContextMenuStrip.Items.Add("GHOST");
                _ghoststrip = handleListView.ContextMenuStrip;
            }
            //set the context menu to our... err, context menu.
            //create and initialize it, first.


            _HeaderContextMenuStrip = new ContextMenuStrip();
            //add a ghost item, so that the Opening Event will fire.
            _HeaderContextMenuStrip.Items.Add("GHOST");
            // _HeaderContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(_HeaderContextMenuStrip_Opening);
            handleListView.ContextMenuStrip.Opening += ContextMenuStrip_Opening;
            handleListView.ContextMenuStripChanged  += new EventHandler(handleListView_ContextMenuStripChanged);
        }
        public GenericListViewSorter(ListView handleListView, GetCompareValue GetCompareRoutine)
        {
            OurListView = handleListView;

            if (GetCompareRoutine != null)
                CompareValueFunc = GetCompareRoutine;
            else
                CompareValueFunc = GetCompareValue_Default;

            handleListView.ColumnClick += new ColumnClickEventHandler(handleListView_ColumnClick);

            //other checks, for headers and whatnot.

            if (handleListView.ContextMenuStrip == null)
            {
                //if it is null, make a new one and add some items to it. We need the Opening Event to fire.
                handleListView.ContextMenuStrip = new ContextMenuStrip();
                handleListView.ContextMenuStrip.Items.Add("GHOST");
                _ghoststrip = handleListView.ContextMenuStrip;
            }
            //set the context menu to our... err, context menu.
            //create and initialize it, first.

            _HeaderContextMenuStrip = new ContextMenuStrip();
            //add a ghost item, so that the Opening Event will fire.
            _HeaderContextMenuStrip.Items.Add("GHOST");
            // _HeaderContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(_HeaderContextMenuStrip_Opening);
            handleListView.ContextMenuStrip.Opening += ContextMenuStrip_Opening;
            handleListView.ContextMenuStripChanged += new EventHandler(handleListView_ContextMenuStripChanged);
        }