public ImageListViewItemComparer(ImageListViewColumnHeader groupColumn, SortOrder groupOrder, ImageListViewColumnHeader sortColumn, SortOrder sortOrder) { mGroupColumn = groupColumn; mSortColumn = sortColumn; mGroupOrder = groupOrder; mSortOrder = sortOrder; }
/// <summary> /// Converts the given value object to the specified type, /// using the specified context and culture information. /// </summary> /// <param name="context">Format context.</param> /// <param name="culture">The culture info. If null is passed, the current culture is assumed.</param> /// <param name="value">The objct to convert.</param> /// <param name="destinationType">The type to convert to.</param> /// <returns>An object that represents the converted value.</returns> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (value != null && value is ImageListViewColumnHeader) { ImageListViewColumnHeader column = (ImageListViewColumnHeader)value; if (destinationType == typeof(InstanceDescriptor)) { string text = column.Text; // Used by the designer serializer if (text == column.DefaultText) { text = string.Empty; } ConstructorInfo consInfo = typeof(ImageListViewColumnHeader).GetConstructor(new Type[] { typeof(ColumnType), typeof(string), typeof(int), typeof(int), typeof(bool) }); return(new InstanceDescriptor(consInfo, new object[] { column.Type, text, column.Width, column.DisplayIndex, column.Visible })); } } return(base.ConvertTo(context, culture, value, destinationType)); }
/// <summary> /// Creates a new object that is a copy of the current instance. /// </summary> /// <returns> /// A new object that is a copy of this instance. /// </returns> public object Clone() { ImageListViewColumnHeader column = new ImageListViewColumnHeader(); column.mDisplayIndex = mDisplayIndex; column.mText = mText; column.mType = mType; column.mVisible = mVisible; column.mWidth = mWidth; return(column); }
/// <summary> /// Creates a new object that is a copy of the current instance. /// </summary> /// <returns> /// A new object that is a copy of this instance. /// </returns> public object Clone() { ImageListViewColumnHeader column = new ImageListViewColumnHeader { mDisplayIndex = mDisplayIndex, mText = mText, mType = mType, mVisible = mVisible, mWidth = mWidth }; return(column); }
/// <summary> /// Initializes a new instance of the HitInfo class. /// </summary> /// <param name="itemIndex">Index of the item.</param> /// <param name="checkBoxHit">if set to true the mouse cursor is over a checkbox.</param> /// <param name="group">The group header hit.</param> /// <param name="column">The column header hit</param> /// <param name="columnSeparator">The column separator.</param> /// <param name="subItemIndex">Index of the sub item.</param> /// <param name="paneBorder">if set to true the mouse cursor is over the left-pane border.</param> /// <param name="inItemArea">if set to true the mouse is in the item area.</param> /// <param name="inHeaderArea">if set to true the mouse cursor is in the column header area.</param> /// <param name="inPaneArea">if set to true the mouse cursor is in the left-pane area.</param> private HitInfo(int itemIndex, bool checkBoxHit, ImageListViewGroup group, ImageListViewColumnHeader column, ImageListViewColumnHeader columnSeparator, int subItemIndex, bool paneBorder, bool inItemArea, bool inHeaderArea, bool inPaneArea) { ItemIndex = itemIndex; CheckBoxHit = checkBoxHit; Group = group; Column = column; ColumnSeparator = columnSeparator; SubItemIndex = subItemIndex; InItemArea = inItemArea; InHeaderArea = inHeaderArea; InPaneArea = inPaneArea; PaneBorder = paneBorder; }
/// <summary> /// Initializes a new instance of the HitInfo class. /// Used when the control registered a column hit. /// </summary> /// <param name="column">Type column hit.</param> /// <param name="columnSeparator">The column separator.</param> internal HitInfo(ImageListViewColumnHeader column, ImageListViewColumnHeader columnSeparator) : this(-1, false, null, column, columnSeparator, -1, false, false, true, false) { ; }
/// <summary> /// Sorts the items by the sort order and sort column of the owner. /// </summary> internal void Sort() { if (mImageListView == null) { return; } mImageListView.GroupsVisible = false; mImageListView.groups.Clear(); if ((mImageListView.GroupOrder == SortOrder.None || mImageListView.GroupColumn < 0 || mImageListView.GroupColumn >= mImageListView.Columns.Count) && (mImageListView.SortOrder == SortOrder.None || mImageListView.SortColumn < 0 || mImageListView.SortColumn >= mImageListView.Columns.Count)) { return; } // Display wait cursor while sorting Cursor cursor = mImageListView.Cursor; mImageListView.Cursor = Cursors.WaitCursor; // Sort and group items ImageListViewColumnHeader sortColumn = null; ImageListViewColumnHeader groupColumn = null; if (mImageListView.GroupColumn >= 0 && mImageListView.GroupColumn < mImageListView.Columns.Count) { groupColumn = mImageListView.Columns[mImageListView.GroupColumn]; } if (mImageListView.SortColumn >= 0 || mImageListView.SortColumn < mImageListView.Columns.Count) { sortColumn = mImageListView.Columns[mImageListView.SortColumn]; } if (mItems.Count == 1 && groupColumn != null) { mItems[0].UpdateGroup(groupColumn); } mItems.Sort(new ImageListViewItemComparer(groupColumn, mImageListView.GroupOrder, sortColumn, mImageListView.SortOrder)); if (mImageListView.GroupOrder != SortOrder.None && groupColumn != null) { mImageListView.GroupsVisible = true; } // Update item indices and create groups string lastGroup = string.Empty; for (int i = 0; i < mItems.Count; i++) { ImageListViewItem item = mItems[i]; item.mIndex = i; string group = item.group; if (string.Compare(lastGroup, group, StringComparison.InvariantCultureIgnoreCase) != 0) { lastGroup = group; mImageListView.groups.Add(group, i, i); } else if (mImageListView.groups.HasName(lastGroup)) { mImageListView.groups[lastGroup].LastItemIndex = i; } } // Restore previous cursor mImageListView.Cursor = cursor; collectionModified = true; }
/// <summary> /// Initializes a new instance of the ColumnHoverEventArgs class. /// </summary> /// <param name="column">The currently hovered column.</param> /// <param name="previousColumn">The previously hovered column.</param> public ColumnHoverEventArgs(ImageListViewColumnHeader column, ImageListViewColumnHeader previousColumn) { Column = column; PreviousColumn = previousColumn; }
/// <summary> /// Initializes a new instance of the ColumnClickEventArgs class. /// </summary> /// <param name="column">The column that is the target of this event.</param> /// <param name="location">The location of the mouse.</param> /// <param name="buttons">One of the System.Windows.Forms.MouseButtons values /// indicating which mouse button was pressed.</param> public ColumnClickEventArgs(ImageListViewColumnHeader column, Point location, MouseButtons buttons) { Column = column; Location = location; Buttons = buttons; }
/// <summary> /// Initializes a new instance of the ColumnEventArgs class. /// </summary> /// <param name="column">The column that is the target of this event.</param> public ColumnEventArgs(ImageListViewColumnHeader column) { Column = column; }