X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FManaged.Windows.Forms%2FSystem.Windows.Forms%2FDataGridViewCellStyle.cs;h=2b26e8bd925e08398fc9c5b0fd7a04357c9eca84;hb=1411b2dffb7bf02f60585c3f87141dbaac9d2de8;hp=9e0cb0675716532ba672cd4331bbc1bb8826e571;hpb=881f83658281916d8f0784df7c726ecb7cc289db;p=mono.git diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyle.cs index 9e0cb067571..2b26e8bd925 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyle.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyle.cs @@ -28,9 +28,13 @@ using System.Drawing; using System.ComponentModel; +using System.Globalization; namespace System.Windows.Forms { + [Editor ("System.Windows.Forms.Design.DataGridViewCellStyleEditor, " + Consts.AssemblySystem_Design, + "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)] + [TypeConverter (typeof (DataGridViewCellStyleConverter))] public class DataGridViewCellStyle : ICloneable { private DataGridViewContentAlignment alignment; @@ -47,14 +51,14 @@ namespace System.Windows.Forms { private object tag; private DataGridViewTriState wrapMode; - public DataGridViewCellStyle () { + public DataGridViewCellStyle () + { alignment = DataGridViewContentAlignment.NotSet; backColor = Color.Empty; font = null; foreColor = Color.Empty; format = String.Empty; - formatProvider = System.Globalization.CultureInfo.CurrentUICulture; - nullValue = "(null)"; + nullValue = string.Empty; padding = Padding.Empty; selectionBackColor = Color.Empty; selectionForeColor = Color.Empty; @@ -62,10 +66,12 @@ namespace System.Windows.Forms { wrapMode = DataGridViewTriState.NotSet; } - public DataGridViewCellStyle (DataGridViewCellStyle dataGridViewCellStyle) { + public DataGridViewCellStyle (DataGridViewCellStyle dataGridViewCellStyle) + { ApplyStyle(dataGridViewCellStyle); } + [DefaultValue (DataGridViewContentAlignment.NotSet)] public DataGridViewContentAlignment Alignment { get { return alignment; } set { @@ -89,6 +95,9 @@ namespace System.Windows.Forms { } } + [Browsable (false)] + [EditorBrowsable (EditorBrowsableState.Advanced)] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public object DataSourceNullValue { get { return dataSourceNullValue; } set { @@ -119,6 +128,10 @@ namespace System.Windows.Forms { } } + [DefaultValue ("")] + [Editor ("System.Windows.Forms.Design.FormatStringEditor, " + Consts.AssemblySystem_Design, + "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)] + [EditorBrowsable (EditorBrowsableState.Advanced)] public string Format { get { return format; } set { @@ -129,8 +142,14 @@ namespace System.Windows.Forms { } } + [Browsable (false)] + [EditorBrowsable (EditorBrowsableState.Advanced)] public IFormatProvider FormatProvider { - get { return formatProvider; } + get { + if (formatProvider == null) + return CultureInfo.CurrentCulture; + return formatProvider; + } set { if (formatProvider != value) { formatProvider = value; @@ -139,23 +158,31 @@ namespace System.Windows.Forms { } } + [Browsable (false)] + [EditorBrowsable (EditorBrowsableState.Advanced)] public bool IsDataSourceNullValueDefault { get { return dataSourceNullValue != null; } } + [Browsable (false)] + [EditorBrowsable (EditorBrowsableState.Advanced)] public bool IsFormatProviderDefault { - get { return formatProvider == System.Globalization.CultureInfo.CurrentUICulture; } + get { return formatProvider == null; } } + [Browsable (false)] + [EditorBrowsable (EditorBrowsableState.Advanced)] public bool IsNullValueDefault { get { if (nullValue is string) { - return (string) nullValue == "(null)"; + return (string) nullValue == string.Empty; } return false; } } + [DefaultValue ("")] + [TypeConverter (typeof (StringConverter))] public object NullValue { get { return nullValue; } set { @@ -199,6 +226,8 @@ namespace System.Windows.Forms { } } + [Browsable (false)] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public object Tag { get { return tag; } set { @@ -209,6 +238,7 @@ namespace System.Windows.Forms { } } + [DefaultValue (DataGridViewTriState.NotSet)] public DataGridViewTriState WrapMode { get { return wrapMode; } set { @@ -222,7 +252,8 @@ namespace System.Windows.Forms { } } - public virtual void ApplyStyle (DataGridViewCellStyle dataGridViewCellStyle) { + public virtual void ApplyStyle (DataGridViewCellStyle dataGridViewCellStyle) + { this.alignment = dataGridViewCellStyle.alignment; this.backColor = dataGridViewCellStyle.backColor; this.dataSourceNullValue = dataGridViewCellStyle.dataSourceNullValue; @@ -238,11 +269,18 @@ namespace System.Windows.Forms { this.wrapMode = dataGridViewCellStyle.wrapMode; } - public virtual object Clone () { + object ICloneable.Clone () + { + return Clone (); + } + + public virtual DataGridViewCellStyle Clone () + { return new DataGridViewCellStyle(this); } - public override bool Equals (object o) { + public override bool Equals (object o) + { if (o is DataGridViewCellStyle) { DataGridViewCellStyle o_aux = (DataGridViewCellStyle) o; return this.alignment == o_aux.alignment && @@ -262,18 +300,21 @@ namespace System.Windows.Forms { return false; } - public override int GetHashCode () { + public override int GetHashCode () + { return base.GetHashCode(); } - public override string ToString () { + public override string ToString () + { /////////////////////////////////////// COMPROBAR EN Windows //////////////////////////////// return ""; } internal event EventHandler StyleChanged; - internal void OnStyleChanged () { + internal void OnStyleChanged () + { if (StyleChanged != null) { StyleChanged(this, EventArgs.Empty); }