Ejemplo n.º 1
0
 /// <summary>
 /// Starts editing a virtual item. While items are edited,
 /// their original images will be seperately cached
 /// instead of fetching them from the file.
 /// </summary>
 /// <param name="guid">The guid representing the item</param>
 public void BeginItemEdit(Guid guid)
 {
     lock (lockObject)
     {
         if (!editCache.ContainsKey(guid))
         {
             VirtualItemImageEventArgs e = new VirtualItemImageEventArgs(mImageListView.Items[guid].mVirtualItemKey);
             mImageListView.RetrieveVirtualItemImageInternal(e);
             if (!string.IsNullOrEmpty(e.FileName))
             {
                 editCache.Add(guid, Image.FromFile(e.FileName));
             }
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the item image.
        /// </summary>
        public Image GetImage()
        {
            if (!editing)
            {
                BeginEdit();
            }
            Image img = null;

            if (isVirtualItem)
            {
                VirtualItemImageEventArgs e = new VirtualItemImageEventArgs(mVirtualItemKey);
                mImageListView.RetrieveVirtualItemImageInternal(e);
                img = Image.FromFile(e.FileName);
            }
            else
            {
                img = Image.FromFile(mFileName);
            }
            if (!editing)
            {
                EndEdit();
            }
            return(img);
        }
            /// <summary>
            /// Handles control's MouseMove event.
            /// </summary>
            public void MouseMove(MouseEventArgs e)
            {
                ImageListViewItem oldHoveredItem = HoveredItem;
                ImageListView.ImageListViewColumnHeader oldHoveredColumn = HoveredColumn;
                ImageListView.ImageListViewColumnHeader oldHoveredSeparator = HoveredSeparator;

                DoHitTest(e.Location);

                mImageListView.mRenderer.SuspendPaint();

                // Do we need to scroll the view?
                if (MouseSelecting && mImageListView.ScrollOrientation == ScrollOrientation.VerticalScroll && !scrollTimer.Enabled)
                {
                    if (e.Y > mImageListView.ClientRectangle.Bottom)
                    {
                        scrollTimer.Tag = -120;
                        scrollTimer.Enabled = true;
                    }
                    else if (e.Y < mImageListView.ClientRectangle.Top)
                    {
                        scrollTimer.Tag = 120;
                        scrollTimer.Enabled = true;
                    }
                }
                else if (MouseSelecting && mImageListView.ScrollOrientation == ScrollOrientation.HorizontalScroll && !scrollTimer.Enabled)
                {
                    if (e.X > mImageListView.ClientRectangle.Right)
                    {
                        scrollTimer.Tag = -120;
                        scrollTimer.Enabled = true;
                    }
                    else if (e.X < mImageListView.ClientRectangle.Left)
                    {
                        scrollTimer.Tag = 120;
                        scrollTimer.Enabled = true;
                    }
                }
                else if (scrollTimer.Enabled && mImageListView.ClientRectangle.Contains(e.Location))
                {
                    scrollTimer.Enabled = false;
                }

                if (DraggingSeperator)
                {
                    int delta = e.Location.X - lastSeparatorDragLocation.X;
                    int colwidth = SelectedSeperator.Width + delta;
                    if (colwidth > 16)
                        lastSeparatorDragLocation = e.Location;
                    else
                    {
                        lastSeparatorDragLocation = new Point(e.Location.X - colwidth + 16, e.Location.Y);
                        colwidth = 16;
                    }
                    SelectedSeperator.Width = colwidth;

                    HoveredItem = null;
                    HoveredColumn = SelectedSeperator;
                    HoveredSeparator = SelectedSeperator;
                    mImageListView.Refresh();
                }
                else if (ResizingPane)
                {
                    int delta = e.Location.X - lastPaneResizeLocation.X;
                    int width = mImageListView.mPaneWidth + delta;
                    if (width > 2)
                        lastPaneResizeLocation = e.Location;
                    else
                    {
                        lastPaneResizeLocation = new Point(e.Location.X - width + 2, e.Location.Y);
                        width = 2;
                    }
                    mImageListView.mPaneWidth = width;

                    HoveredItem = null;
                    HoveredColumn = null;
                    HoveredSeparator = null;
                    mImageListView.Refresh();
                }
                else if (MouseSelecting)
                {
                    if (!ShiftKey && !ControlKey)
                        mImageListView.SelectedItems.Clear(false);

                    // Create the selection rectangle
                    Point viewOffset = mImageListView.ViewOffset;
                    Point pt1 = new Point(lastMouseDownLocation.X - (viewOffset.X - lastViewOffset.X),
                        lastMouseDownLocation.Y - (viewOffset.Y - lastViewOffset.Y));
                    Point pt2 = new Point(e.Location.X, e.Location.Y);
                    SelectionRectangle = new Rectangle(Math.Min(pt1.X, pt2.X), Math.Min(pt1.Y, pt2.Y), Math.Abs(pt1.X - pt2.X), Math.Abs(pt1.Y - pt2.Y));

                    // Normalize to item area coordinates
                    pt1 = new Point(SelectionRectangle.Left, SelectionRectangle.Top);
                    pt2 = new Point(SelectionRectangle.Right, SelectionRectangle.Bottom);
                    Point itemAreaOffset = new Point(-mImageListView.layoutManager.ItemAreaBounds.Left,
                        -mImageListView.layoutManager.ItemAreaBounds.Top);
                    pt1.Offset(itemAreaOffset);
                    pt2.Offset(itemAreaOffset);

                    // Determine which items are highlighted
                    highlightedItems.Clear();
                    int startRow = (int)Math.Floor((float)(Math.Min(pt1.Y, pt2.Y) + viewOffset.Y) /
                        (float)mImageListView.layoutManager.ItemSizeWithMargin.Height);
                    int endRow = (int)Math.Floor((float)(Math.Max(pt1.Y, pt2.Y) + viewOffset.Y) /
                        (float)mImageListView.layoutManager.ItemSizeWithMargin.Height);
                    int startCol = (int)Math.Floor((float)(Math.Min(pt1.X, pt2.X) + viewOffset.X) /
                        (float)mImageListView.layoutManager.ItemSizeWithMargin.Width);
                    int endCol = (int)Math.Floor((float)(Math.Max(pt1.X, pt2.X) + viewOffset.X) /
                        (float)mImageListView.layoutManager.ItemSizeWithMargin.Width);
                    if (mImageListView.ScrollOrientation == ScrollOrientation.HorizontalScroll &&
                        (startRow >= 0 || endRow >= 0))
                    {
                        for (int i = startCol; i <= endCol; i++)
                        {
                            for (int col = startCol; col <= endCol; col++)
                            {
                                if (i >= 0 && i <= mImageListView.Items.Count - 1 &&
                                    !highlightedItems.ContainsKey(mImageListView.Items[i]))
                                    highlightedItems.Add(mImageListView.Items[i],
                                        (ControlKey ? !mImageListView.Items[i].Selected : true));
                            }
                        }
                    }
                    else if (mImageListView.ScrollOrientation == ScrollOrientation.VerticalScroll &&
                        (startCol >= 0 || endCol >= 0) && (startRow >= 0 || endRow >= 0) &&
                        (startCol <= mImageListView.layoutManager.Cols - 1 || endCol <= mImageListView.layoutManager.Cols - 1))
                    {
                        startCol = Math.Min(mImageListView.layoutManager.Cols - 1, Math.Max(0, startCol));
                        endCol = Math.Min(mImageListView.layoutManager.Cols - 1, Math.Max(0, endCol));
                        for (int row = startRow; row <= endRow; row++)
                        {
                            for (int col = startCol; col <= endCol; col++)
                            {
                                int i = row * mImageListView.layoutManager.Cols + col;
                                if (i >= 0 && i <= mImageListView.Items.Count - 1 &&
                                    !highlightedItems.ContainsKey(mImageListView.Items[i]))
                                    highlightedItems.Add(mImageListView.Items[i],
                                        (ControlKey ? !mImageListView.Items[i].Selected : true));
                            }
                        }
                    }

                    HoveredColumn = null;
                    HoveredSeparator = null;
                    SelectedSeperator = null;

                    mImageListView.Refresh();
                }
                else if (!MouseSelecting && !DraggingSeperator && !ResizingPane &&
                    inItemArea && lastMouseDownInItemArea &&
                    (LeftButton || RightButton) &&
                    ((Math.Abs(e.Location.X - lastMouseDownLocation.X) > SelectionTolerance ||
                    Math.Abs(e.Location.Y - lastMouseDownLocation.Y) > SelectionTolerance)))
                {
                    if (!lastMouseDownOverItem && HoveredItem == null)
                    {
                        // Start mouse selection
                        MouseSelecting = true;
                        SelectionRectangle = new Rectangle(lastMouseDownLocation, new Size(0, 0));
                        mImageListView.Refresh();
                    }
                    else if (lastMouseDownOverItem && HoveredItem != null && mImageListView.AllowDrag)
                    {
                        // Start drag&drop
                        if (!HoveredItem.Selected)
                        {
                            mImageListView.SelectedItems.Clear(false);
                            HoveredItem.mSelected = true;
                            mImageListView.OnSelectionChangedInternal();
                            DropTarget = null;
                            mImageListView.Refresh(true);
                        }

                        // Set drag data
                        List<string> filenames = new List<string>();
                        foreach (ImageListViewItem item in mImageListView.SelectedItems)
                        {
                            if (item.isVirtualItem)
                            {
                                // Get the virtual item source image
                                VirtualItemImageEventArgs ve = new VirtualItemImageEventArgs(item.mVirtualItemKey);
                                mImageListView.RetrieveVirtualItemImageInternal(ve);
                                if (!string.IsNullOrEmpty(ve.FileName))
                                    filenames.Add(ve.FileName);
                            }
                            else
                            {
                                filenames.Add(item.FileName);
                            }
                        }
                        DataObject data = new DataObject(DataFormats.FileDrop, filenames.ToArray());
                        DropTarget = null;
                        selfDragging = true;
                        mImageListView.DoDragDrop(data, DragDropEffects.Copy);
                        selfDragging = false;

                        // Since the MouseUp event will be eaten by DoDragDrop we will not receive
                        // the MouseUp event. We need to manually update mouse button flags after
                        // the drop.
                        if ((Control.MouseButtons & MouseButtons.Left) == MouseButtons.None)
                            LeftButton = false;
                        if ((Control.MouseButtons & MouseButtons.Right) == MouseButtons.None)
                            RightButton = false;
                    }
                }
                else if (!MouseSelecting && !DraggingSeperator && !ResizingPane &&
                    inHeaderArea && lastMouseDownInColumnHeaderArea && lastMouseDownOverSeparator && LeftButton &&
                    mImageListView.AllowColumnResize && HoveredSeparator != null)
                {
                    // Start dragging a separator
                    DraggingSeperator = true;
                    SelectedSeperator = HoveredSeparator;
                    lastSeparatorDragLocation = e.Location;
                }
                else if (!MouseSelecting && !DraggingSeperator && !ResizingPane &&
                    inPaneArea && lastMouseDownInPaneArea && lastMouseDownOverPaneBorder && LeftButton &&
                    mImageListView.AllowPaneResize && HoveredPaneBorder != false)
                {
                    // Start dragging the pane
                    ResizingPane = true;
                    lastPaneResizeLocation = e.Location;
                }
                else if (!ReferenceEquals(HoveredItem, oldHoveredItem) ||
                    !ReferenceEquals(HoveredColumn, oldHoveredColumn) ||
                    !ReferenceEquals(HoveredSeparator, oldHoveredSeparator))
                {
                    // Hovered item changed
                    if (!ReferenceEquals(HoveredItem, oldHoveredItem))
                        mImageListView.OnItemHover(new ItemHoverEventArgs(HoveredItem, oldHoveredItem));

                    if (!ReferenceEquals(HoveredColumn, oldHoveredColumn))
                        mImageListView.OnColumnHover(new ColumnHoverEventArgs(HoveredColumn, oldHoveredColumn));

                    mImageListView.Refresh();
                }

                mImageListView.mRenderer.ResumePaint();

                // Change to size cursor if mouse is over a column separator or pane border
                if (mImageListView.Cursor != Cursors.VSplit && mImageListView.Focused && !MouseSelecting)
                {
                    if ((mImageListView.AllowColumnResize && HoveredSeparator != null) ||
                        (mImageListView.AllowPaneResize && HoveredPaneBorder != false))
                        mImageListView.Cursor = Cursors.VSplit;
                }
                else if (mImageListView.Cursor == Cursors.VSplit)
                {
                    if (!((inHeaderArea && (DraggingSeperator || HoveredSeparator != null)) ||
                        (inPaneArea && (ResizingPane || HoveredPaneBorder != false))))
                        mImageListView.Cursor = Cursors.Default;
                }

                lastMouseMoveLocation = e.Location;
            }
Ejemplo n.º 4
0
 /// <summary>
 /// Raises the RetrieveVirtualItemImage event.
 /// </summary>
 /// <param name="e">A VirtualItemImageEventArgs that contains event data.</param>
 protected virtual void OnRetrieveVirtualItemImage(VirtualItemImageEventArgs e)
 {
     if (RetrieveVirtualItemImage != null)
         RetrieveVirtualItemImage(this, e);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Raises the RetrieveVirtualItemImage event.
 /// This method is invoked from the thumbnail thread.
 /// </summary>
 /// <param name="e">A VirtualItemImageEventArgs that contains event data.</param>
 internal virtual void RetrieveVirtualItemImageInternal(VirtualItemImageEventArgs e)
 {
     OnRetrieveVirtualItemImage(e);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Gets the item image.
 /// </summary>
 public Image GetImage()
 {
     if (!editing) BeginEdit();
     Image img = null;
     if (isVirtualItem)
     {
         VirtualItemImageEventArgs e = new VirtualItemImageEventArgs(mVirtualItemKey);
         mImageListView.RetrieveVirtualItemImageInternal(e);
         img = Image.FromFile(e.FileName);
     }
     else
         img = Image.FromFile(mFileName);
     if (!editing) EndEdit();
     return img;
 }
 /// <summary>
 /// Starts editing a virtual item. While items are edited,
 /// their original images will be seperately cached
 /// instead of fetching them from the file.
 /// </summary>
 /// <param name="guid">The guid representing the item</param>
 public void BeginItemEdit(Guid guid)
 {
     lock (lockObject)
     {
         if (!editCache.ContainsKey(guid))
         {
             VirtualItemImageEventArgs e = new VirtualItemImageEventArgs(mImageListView.Items[guid].mVirtualItemKey);
             mImageListView.RetrieveVirtualItemImageInternal(e);
             if (!string.IsNullOrEmpty(e.FileName))
                 editCache.Add(guid, Image.FromFile(e.FileName));
         }
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Starts editing a virtual item. While items are edited,
 /// their original images will be seperately cached
 /// instead of fetching them from the file.
 /// </summary>
 /// <param name="guid">The guid representing the item</param>
 public void BeginItemEdit(Guid guid)
 {
     lock (lockObject)
     {
         if (!editCache.ContainsKey(guid))
         {
             VirtualItemImageEventArgs e = new VirtualItemImageEventArgs(mImageListView.Items[guid].mVirtualItemKey);
             mImageListView.RetrieveVirtualItemImageInternal(e);
             if (!string.IsNullOrEmpty(e.FileName))
             {
                 using (FileStream stream = new FileStream(e.FileName, FileMode.Open, FileAccess.Read))
                 {
                     using (Image img = Image.FromStream(stream))
                     {
                         editCache.Add(guid, new Bitmap(img));
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 9
0
            /// <summary>
            /// Handles control's MouseMove event.
            /// </summary>
            public void MouseMove(MouseEventArgs e)
            {
                ImageListViewItem oldHoveredItem = HoveredItem;

                ImageListView.ImageListViewColumnHeader oldHoveredColumn    = HoveredColumn;
                ImageListView.ImageListViewColumnHeader oldHoveredSeparator = HoveredSeparator;

                DoHitTest(e.Location);

                mImageListView.mRenderer.SuspendPaint();

                // Do we need to scroll the view?
                if (MouseSelecting && mImageListView.ScrollOrientation == ScrollOrientation.VerticalScroll && !scrollTimer.Enabled)
                {
                    if (e.Y > mImageListView.ClientRectangle.Bottom)
                    {
                        scrollTimer.Tag     = -120;
                        scrollTimer.Enabled = true;
                    }
                    else if (e.Y < mImageListView.ClientRectangle.Top)
                    {
                        scrollTimer.Tag     = 120;
                        scrollTimer.Enabled = true;
                    }
                }
                else if (MouseSelecting && mImageListView.ScrollOrientation == ScrollOrientation.HorizontalScroll && !scrollTimer.Enabled)
                {
                    if (e.X > mImageListView.ClientRectangle.Right)
                    {
                        scrollTimer.Tag     = -120;
                        scrollTimer.Enabled = true;
                    }
                    else if (e.X < mImageListView.ClientRectangle.Left)
                    {
                        scrollTimer.Tag     = 120;
                        scrollTimer.Enabled = true;
                    }
                }
                else if (scrollTimer.Enabled && mImageListView.ClientRectangle.Contains(e.Location))
                {
                    scrollTimer.Enabled = false;
                }

                if (DraggingSeperator)
                {
                    int delta    = e.Location.X - lastSeparatorDragLocation.X;
                    int colwidth = SelectedSeperator.Width + delta;
                    if (colwidth > 16)
                    {
                        lastSeparatorDragLocation = e.Location;
                    }
                    else
                    {
                        lastSeparatorDragLocation = new Point(e.Location.X - colwidth + 16, e.Location.Y);
                        colwidth = 16;
                    }
                    SelectedSeperator.Width = colwidth;

                    HoveredItem      = null;
                    HoveredColumn    = SelectedSeperator;
                    HoveredSeparator = SelectedSeperator;
                    mImageListView.Refresh();
                }
                else if (ResizingPane)
                {
                    int delta = e.Location.X - lastPaneResizeLocation.X;
                    int width = mImageListView.mPaneWidth + delta;
                    if (width > 2)
                    {
                        lastPaneResizeLocation = e.Location;
                    }
                    else
                    {
                        lastPaneResizeLocation = new Point(e.Location.X - width + 2, e.Location.Y);
                        width = 2;
                    }
                    mImageListView.mPaneWidth = width;

                    HoveredItem      = null;
                    HoveredColumn    = null;
                    HoveredSeparator = null;
                    mImageListView.Refresh();
                }
                else if (MouseSelecting)
                {
                    if (!ShiftKey && !ControlKey)
                    {
                        mImageListView.SelectedItems.Clear(false);
                    }

                    // Create the selection rectangle
                    Point viewOffset = mImageListView.ViewOffset;
                    Point pt1        = new Point(lastMouseDownLocation.X - (viewOffset.X - lastViewOffset.X),
                                                 lastMouseDownLocation.Y - (viewOffset.Y - lastViewOffset.Y));
                    Point pt2 = new Point(e.Location.X, e.Location.Y);
                    SelectionRectangle = new Rectangle(Math.Min(pt1.X, pt2.X), Math.Min(pt1.Y, pt2.Y), Math.Abs(pt1.X - pt2.X), Math.Abs(pt1.Y - pt2.Y));

                    // Normalize to item area coordinates
                    pt1 = new Point(SelectionRectangle.Left, SelectionRectangle.Top);
                    pt2 = new Point(SelectionRectangle.Right, SelectionRectangle.Bottom);
                    Point itemAreaOffset = new Point(-mImageListView.layoutManager.ItemAreaBounds.Left,
                                                     -mImageListView.layoutManager.ItemAreaBounds.Top);
                    pt1.Offset(itemAreaOffset);
                    pt2.Offset(itemAreaOffset);

                    // Determine which items are highlighted
                    highlightedItems.Clear();
                    int startRow = (int)Math.Floor((float)(Math.Min(pt1.Y, pt2.Y) + viewOffset.Y) /
                                                   (float)mImageListView.layoutManager.ItemSizeWithMargin.Height);
                    int endRow = (int)Math.Floor((float)(Math.Max(pt1.Y, pt2.Y) + viewOffset.Y) /
                                                 (float)mImageListView.layoutManager.ItemSizeWithMargin.Height);
                    int startCol = (int)Math.Floor((float)(Math.Min(pt1.X, pt2.X) + viewOffset.X) /
                                                   (float)mImageListView.layoutManager.ItemSizeWithMargin.Width);
                    int endCol = (int)Math.Floor((float)(Math.Max(pt1.X, pt2.X) + viewOffset.X) /
                                                 (float)mImageListView.layoutManager.ItemSizeWithMargin.Width);
                    if (mImageListView.ScrollOrientation == ScrollOrientation.HorizontalScroll &&
                        (startRow >= 0 || endRow >= 0))
                    {
                        for (int i = startCol; i <= endCol; i++)
                        {
                            for (int col = startCol; col <= endCol; col++)
                            {
                                if (i >= 0 && i <= mImageListView.Items.Count - 1 &&
                                    !highlightedItems.ContainsKey(mImageListView.Items[i]))
                                {
                                    highlightedItems.Add(mImageListView.Items[i],
                                                         (ControlKey ? !mImageListView.Items[i].Selected : true));
                                }
                            }
                        }
                    }
                    else if (mImageListView.ScrollOrientation == ScrollOrientation.VerticalScroll &&
                             (startCol >= 0 || endCol >= 0) && (startRow >= 0 || endRow >= 0) &&
                             (startCol <= mImageListView.layoutManager.Cols - 1 || endCol <= mImageListView.layoutManager.Cols - 1))
                    {
                        startCol = Math.Min(mImageListView.layoutManager.Cols - 1, Math.Max(0, startCol));
                        endCol   = Math.Min(mImageListView.layoutManager.Cols - 1, Math.Max(0, endCol));
                        for (int row = startRow; row <= endRow; row++)
                        {
                            for (int col = startCol; col <= endCol; col++)
                            {
                                int i = row * mImageListView.layoutManager.Cols + col;
                                if (i >= 0 && i <= mImageListView.Items.Count - 1 &&
                                    !highlightedItems.ContainsKey(mImageListView.Items[i]))
                                {
                                    highlightedItems.Add(mImageListView.Items[i],
                                                         (ControlKey ? !mImageListView.Items[i].Selected : true));
                                }
                            }
                        }
                    }

                    HoveredColumn     = null;
                    HoveredSeparator  = null;
                    SelectedSeperator = null;

                    mImageListView.Refresh();
                }
                else if (!MouseSelecting && !DraggingSeperator && !ResizingPane &&
                         inItemArea && lastMouseDownInItemArea &&
                         (LeftButton || RightButton) &&
                         ((Math.Abs(e.Location.X - lastMouseDownLocation.X) > SelectionTolerance ||
                           Math.Abs(e.Location.Y - lastMouseDownLocation.Y) > SelectionTolerance)))
                {
                    if (!lastMouseDownOverItem && HoveredItem == null)
                    {
                        // Start mouse selection
                        MouseSelecting     = true;
                        SelectionRectangle = new Rectangle(lastMouseDownLocation, new Size(0, 0));
                        mImageListView.Refresh();
                    }
                    else if (lastMouseDownOverItem && HoveredItem != null && mImageListView.AllowDrag)
                    {
                        // Start drag&drop
                        if (!HoveredItem.Selected)
                        {
                            mImageListView.SelectedItems.Clear(false);
                            HoveredItem.mSelected = true;
                            mImageListView.OnSelectionChangedInternal();
                            DropTarget = null;
                            mImageListView.Refresh(true);
                        }

                        // Set drag data
                        List <string> filenames = new List <string>();
                        foreach (ImageListViewItem item in mImageListView.SelectedItems)
                        {
                            if (item.isVirtualItem)
                            {
                                // Get the virtual item source image
                                VirtualItemImageEventArgs ve = new VirtualItemImageEventArgs(item.mVirtualItemKey);
                                mImageListView.RetrieveVirtualItemImageInternal(ve);
                                if (!string.IsNullOrEmpty(ve.FileName))
                                {
                                    filenames.Add(ve.FileName);
                                }
                            }
                            else
                            {
                                filenames.Add(item.FileName);
                            }
                        }
                        DataObject data = new DataObject(DataFormats.FileDrop, filenames.ToArray());
                        DropTarget   = null;
                        selfDragging = true;
                        mImageListView.DoDragDrop(data, DragDropEffects.Copy);
                        selfDragging = false;

                        // Since the MouseUp event will be eaten by DoDragDrop we will not receive
                        // the MouseUp event. We need to manually update mouse button flags after
                        // the drop.
                        if ((Control.MouseButtons & MouseButtons.Left) == MouseButtons.None)
                        {
                            LeftButton = false;
                        }
                        if ((Control.MouseButtons & MouseButtons.Right) == MouseButtons.None)
                        {
                            RightButton = false;
                        }
                    }
                }
                else if (!MouseSelecting && !DraggingSeperator && !ResizingPane &&
                         inHeaderArea && lastMouseDownInColumnHeaderArea && lastMouseDownOverSeparator && LeftButton &&
                         mImageListView.AllowColumnResize && HoveredSeparator != null)
                {
                    // Start dragging a separator
                    DraggingSeperator         = true;
                    SelectedSeperator         = HoveredSeparator;
                    lastSeparatorDragLocation = e.Location;
                }
                else if (!MouseSelecting && !DraggingSeperator && !ResizingPane &&
                         inPaneArea && lastMouseDownInPaneArea && lastMouseDownOverPaneBorder && LeftButton &&
                         mImageListView.AllowPaneResize && HoveredPaneBorder != false)
                {
                    // Start dragging the pane
                    ResizingPane           = true;
                    lastPaneResizeLocation = e.Location;
                }
                else if (!ReferenceEquals(HoveredItem, oldHoveredItem) ||
                         !ReferenceEquals(HoveredColumn, oldHoveredColumn) ||
                         !ReferenceEquals(HoveredSeparator, oldHoveredSeparator))
                {
                    // Hovered item changed
                    if (!ReferenceEquals(HoveredItem, oldHoveredItem))
                    {
                        mImageListView.OnItemHover(new ItemHoverEventArgs(HoveredItem, oldHoveredItem));
                    }

                    if (!ReferenceEquals(HoveredColumn, oldHoveredColumn))
                    {
                        mImageListView.OnColumnHover(new ColumnHoverEventArgs(HoveredColumn, oldHoveredColumn));
                    }

                    mImageListView.Refresh();
                }

                mImageListView.mRenderer.ResumePaint();

                // Change to size cursor if mouse is over a column separator or pane border
                if (mImageListView.Cursor != Cursors.VSplit && mImageListView.Focused && !MouseSelecting)
                {
                    if ((mImageListView.AllowColumnResize && HoveredSeparator != null) ||
                        (mImageListView.AllowPaneResize && HoveredPaneBorder != false))
                    {
                        mImageListView.Cursor = Cursors.VSplit;
                    }
                }
                else if (mImageListView.Cursor == Cursors.VSplit)
                {
                    if (!((inHeaderArea && (DraggingSeperator || HoveredSeparator != null)) ||
                          (inPaneArea && (ResizingPane || HoveredPaneBorder != false))))
                    {
                        mImageListView.Cursor = Cursors.Default;
                    }
                }

                lastMouseMoveLocation = e.Location;
            }