diff options
author | Carlos Alberto Cortez <calberto.cortez@gmail.com> | 2007-01-10 01:18:27 +0300 |
---|---|---|
committer | Carlos Alberto Cortez <calberto.cortez@gmail.com> | 2007-01-10 01:18:27 +0300 |
commit | ffeede9908b5cf678e0e5fa3d15bb07d54c5444a (patch) | |
tree | fa678bebbd6f23f813f43877faea03f5b00cfec3 | |
parent | b13c60ad6916532940f027dba6a2211c47a14b11 (diff) |
2007-01-09 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* ColumnHeader.cs: Implement 2.0 AutoResize method using
the Width property.
* ListView.cs: Implement 2.0 AutoResizeColumn and AutoResizeColumns
methods by callling Column.AutoResize method on columns.
svn path=/trunk/mcs/; revision=70745
3 files changed, 45 insertions, 0 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog index e27b7f173b1..07881f7d3b9 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog @@ -1,3 +1,11 @@ +2007-01-09 Carlos Alberto Cortez <calberto.cortez@gmail.com> + + * ColumnHeader.cs: Implement 2.0 AutoResize method using + the Width property. + + * ListView.cs: Implement 2.0 AutoResizeColumn and AutoResizeColumns + methods by callling Column.AutoResize method on columns. + 2007-01-09 Jonathan Pobst <monkey@jpobst.com> * Control.cs: Provide proper implementations of PreferredSize 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 807c0f6a794..42d49d8e063 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs @@ -307,6 +307,25 @@ namespace System.Windows.Forms #endregion // Public Instance Properties #region Public Methods +#if NET_2_0 + public void AutoResize (ColumnHeaderAutoResizeStyle headerAutoResize) + { + switch (headerAutoResize) { + case ColumnHeaderAutoResizeStyle.None: + break; + case ColumnHeaderAutoResizeStyle.ColumnContent: + Width = -1; + break; + case ColumnHeaderAutoResizeStyle.HeaderSize: + Width = -2; + break; + default: + throw new InvalidEnumArgumentException ("headerAutoResize", (int) headerAutoResize, + typeof (ColumnHeaderAutoResizeStyle)); + } + } +#endif + public object Clone () { ColumnHeader columnHeader = new ColumnHeader (); diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs index da814a276f3..60c76b9b705 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs @@ -2300,6 +2300,24 @@ namespace System.Windows.Forms } } +#if NET_2_0 + public void AutoResizeColumn (int columnIndex, ColumnHeaderAutoResizeStyle headerAutoResize) + { + if (columnIndex < 0 || columnIndex >= columns.Count) + throw new ArgumentOutOfRangeException ("columnIndex"); + + columns [columnIndex].AutoResize (headerAutoResize); + } + + public void AutoResizeColumns (ColumnHeaderAutoResizeStyle headerAutoResize) + { + BeginUpdate (); + foreach (ColumnHeader col in columns) + col.AutoResize (headerAutoResize); + EndUpdate (); + } +#endif + public void BeginUpdate () { // flag to avoid painting |