public static RowPromptStyles FromString(string InString) { RowPromptStyles rps = new RowPromptStyles( ); int ix = 0; string[] vlus = new string[4]; CsvCursor csr = new CsvCursor(InString); for (ix = 0; ix <= 3; ++ix) { csr.NextValue( ); if (csr.IsBraced == true) { throw new ApplicationException( "serialized RowPromptStyles string contains invalid format"); } vlus[ix] = csr.ItemValue; } // load the parsed values rps.mPanelClass = vlus[0]; rps.mTitleClass = vlus[1]; rps.mHeadingClass = vlus[2]; rps.mFieldClass = vlus[3]; return(rps); }
// convert from string to RowPromptStyles public override object ConvertFrom( ITypeDescriptorContext context, CultureInfo culture, object InValue) { if (InValue is string) { return(RowPromptStyles.FromString((string)InValue)); } return(base.ConvertFrom(context, culture, InValue)); }
// Overrides the ConvertTo method of TypeConverter. public override object ConvertTo( ITypeDescriptorContext context, CultureInfo culture, object InValue, Type destinationType) { if (destinationType == typeof(string)) { RowPromptStyles msgs = (RowPromptStyles)InValue; return(msgs.ToString()); } return(base.ConvertTo(context, culture, InValue, destinationType)); }