diff options
author | Gert Driesen <drieseng@users.sourceforge.net> | 2007-03-02 00:53:20 +0300 |
---|---|---|
committer | Gert Driesen <drieseng@users.sourceforge.net> | 2007-03-02 00:53:20 +0300 |
commit | a46f1f61071fd0ac476c51a5309361296487c5dc (patch) | |
tree | 620d7025c97a3710b5dd472c6621ec166740b31f /mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs | |
parent | 97fc5dad07b155a04299713e69e89a306f365af0 (diff) |
* ListView.cs: Add fireEvent argument to ReorderColumn since the
ColumnReordered event must not be signaled when modifying DisplayIndex
of a ColumnHeader. Added internal ReorderColumns method which takes
care of drawing, and updating the internal DisplayIndex of the
ColumnHeader. Added AddColumn method which is invoked from
ColumnHeaderCollection when adding or inserting columns, and which
ensures that reorder_columns_indices is kept in sync. Avoid redrawing
after adding each ColumnHeader in ColumnHeaderCollection.AddRange.
Recalculated dispay indices after removing a ColumnHeader.
* ColumnHeader.cs: Save DisplayIndex separately from ListView to
match MS. Allows last display index to be returned after ListView
is disposed. Update actual location of ColumnHeader when DisplayIndex
is modified.
* ListViewCollectionsTest.cs: Added ColumnHeader.Index tests.
* ColumnHeaderTest.cs: Added more DisplayIndex tests.
svn path=/trunk/mcs/; revision=73617
Diffstat (limited to 'mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs')
-rw-r--r-- | mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs index e4970728d51..b6c3f5c9687 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs @@ -51,6 +51,7 @@ namespace System.Windows.Forms private string name = String.Empty; private object tag; #endif + private int display_index = -1; // internal variables Rectangle column_rect = Rectangle.Empty; @@ -132,8 +133,13 @@ namespace System.Windows.Forms get { return format; } } + internal int InternalDisplayIndex { + get { return display_index; } + set { display_index = value; } + } + internal void CalcColumnHeader () - { + { if (text_alignment == HorizontalAlignment.Center) format.Alignment = StringAlignment.Center; else if (text_alignment == HorizontalAlignment.Right) @@ -167,23 +173,26 @@ namespace System.Windows.Forms #endregion // Private Internal Methods Properties #region Public Instance Properties + #if NET_2_0 [Localizable (true)] [RefreshProperties (RefreshProperties.Repaint)] public int DisplayIndex { get { if (owner == null) - return -1; + return display_index; return owner.GetReorderedColumnIndex (this); - } + } set { - if (owner == null) + if (owner == null) { + display_index = value; return; + } if (value < 0 || value >= owner.Columns.Count) - throw new ArgumentOutOfRangeException ("value"); + throw new ArgumentOutOfRangeException ("DisplayIndex"); - owner.ReorderColumn (this, value); + owner.ReorderColumn (this, value, false); } } |