/// <summary> /// Copies the this. /// </summary> /// <param name="o">The o.</param> private void CopyThis(ZeroitBusyBarPainterLine o) { _Preset = o._Preset; _LineColor = o._LineColor; _LineWidth = o._LineWidth; // _Wrap = o._Wrap ; }
/// <summary> /// Initializes a new instance of the <see cref="ZeroitBusyBarPainterLine"/> class. /// </summary> /// <param name="o">The o.</param> protected ZeroitBusyBarPainterLine(ZeroitBusyBarPainterLine o) : base(o) { // OnBarSet(); CopyThis(o); }
/// <summary> /// Converts the given value object to the specified type, using the specified context and culture information. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.</param> /// <param name="culture">A <see cref="T:System.Globalization.CultureInfo" />. If null is passed, the current culture is assumed.</param> /// <param name="value">The <see cref="T:System.Object" /> to convert.</param> /// <param name="destinationType">The <see cref="T:System.Type" /> to convert the <paramref name="value" /> parameter to.</param> /// <returns>An <see cref="T:System.Object" /> that represents the converted value.</returns> public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (1 == 1) { string s = String.Empty; s += "ZeroitBusyBarPainterLine.ConvertTo " + destinationType.FullName; s += "\nfrom " + value.GetType().FullName; if (context == null) { s += "\ncontext is null"; } else if (context.Instance == null) { s += "\nInstance is null"; } else { s += "\nInstance: " + context.Instance.GetType().FullName; } MessageBox.Show(s); } if (destinationType == typeof(InstanceDescriptor)) { if (value is ZeroitBusyBarPainterLine) { ZeroitBusyBarPainterLine o = (ZeroitBusyBarPainterLine)value; ConstructorInfo ctor = typeof(ZeroitBusyBarPainterLine).GetConstructor( Type.EmptyTypes); if (ctor != null) { MessageBox.Show("ZeroitBusyBarPainterLine.ConvertTo success!"); return(new InstanceDescriptor( ctor, null, true)); } // ConstructorInfo ctor = typeof( ZeroitBusyBarPainterLine ).GetConstructor( // BindingFlags.Public | BindingFlags.Instance, // null, // new Type[] // { // typeof( Color ), // typeof( int ), // }, // null ); // // if ( ctor != null ) // { // MessageBox.Show( "ZeroitBusyBarPainterLine.ConvertTo success!" ); // return new InstanceDescriptor( // ctor, // new object[] // { // o.LineColor, // o.LineWidth, // }, // true ); // } } } return(base.ConvertTo(context, culture, value, destinationType)); }