//*************************************************************************
    //  Constructor: LabelUserSettingsDialog()
    //
    /// <summary>
    /// Initializes a new instance of the <see
    /// cref="LabelUserSettingsDialog" /> class.
    /// </summary>
    ///
    /// <param name="labelUserSettings">
    /// The object being edited.
    /// </param>
    //*************************************************************************

    public LabelUserSettingsDialog
    (
        LabelUserSettings labelUserSettings
    )
    {
        Debug.Assert(labelUserSettings != null);
        labelUserSettings.AssertValid();

        m_oLabelUserSettings = labelUserSettings;
        m_oFont = m_oLabelUserSettings.Font;

        // Instantiate an object that saves and retrieves the position of this
        // dialog.  Note that the object automatically saves the settings when
        // the form closes.

        m_oLabelUserSettingsDialogUserSettings =
            new LabelUserSettingsDialogUserSettings(this);

        InitializeComponent();

        usrVertexLabelMaximumLength.AccessKey = 'c';
        usrEdgeLabelMaximumLength.AccessKey = 'T';
        cbxVertexLabelPosition.Populate();

        nudGroupLabelTextAlpha.Minimum =
            (Decimal)AlphaConverter.MinimumAlphaWorkbook;

        nudGroupLabelTextAlpha.Maximum =
            (Decimal)AlphaConverter.MaximumAlphaWorkbook;

        cbxGroupLabelPosition.Populate();

        DoDataExchange(false);

        AssertValid();
    }
    ConvertFrom
    (
        ITypeDescriptorContext context,
        CultureInfo culture,
        Object value
    )
    {
        Debug.Assert(value != null);
        Debug.Assert(value is String);
        AssertValid();

        LabelUserSettings oLabelUserSettings = new LabelUserSettings();

        String [] asStrings = ( (String)value ).Split( new Char[] {'\t'} );

        Debug.Assert(asStrings.Length >= 5);

        ColorConverter oColorConverter = new ColorConverter();

        oLabelUserSettings.Font = (Font)
            ( new FontConverter() ).ConvertFromInvariantString(asStrings[0] );

        oLabelUserSettings.VertexLabelFillColor = (Color)
            oColorConverter.ConvertFromInvariantString(asStrings[1] );

        oLabelUserSettings.VertexLabelPosition = (VertexLabelPosition)
            Enum.Parse( typeof(VertexLabelPosition), asStrings[2] );

        oLabelUserSettings.VertexLabelMaximumLength =
            MathUtil.ParseCultureInvariantInt32( asStrings[3] );

        oLabelUserSettings.EdgeLabelMaximumLength =
            MathUtil.ParseCultureInvariantInt32(asStrings[4]);

        if (asStrings.Length > 5)
        {
            // Edge label text color wasn't added until version 1.0.1.154.

            oLabelUserSettings.EdgeLabelTextColor = (Color)
                oColorConverter.ConvertFromInvariantString(asStrings[5] );
        }

        if (asStrings.Length > 6)
        {
            // Vertex label wrapping wasn't added until version 1.0.1.175.

            oLabelUserSettings.VertexLabelWrapText =
                Boolean.Parse( asStrings[6] );

            oLabelUserSettings.VertexLabelWrapMaxTextWidth =
                MathUtil.ParseCultureInvariantDouble( asStrings[7] );
        }

        if (asStrings.Length > 8)
        {
            // Group label text color and alpha weren't added until version
            // 1.0.1.190.

            oLabelUserSettings.GroupLabelTextColor = (Color)
                oColorConverter.ConvertFromInvariantString( asStrings[8] );

            oLabelUserSettings.GroupLabelTextAlpha =
                MathUtil.ParseCultureInvariantSingle( asStrings[9] );
        }

        if (asStrings.Length > 10)
        {
            // Group label position wasn't added until version 1.0.1.215.

            oLabelUserSettings.GroupLabelPosition = (VertexLabelPosition)
                Enum.Parse( typeof(VertexLabelPosition), asStrings[10] );
        }

        return (oLabelUserSettings);
    }
    Copy()
    {
        AssertValid();

        LabelUserSettings oCopy = new LabelUserSettings();

        oCopy.Font = this.Font;
        oCopy.VertexLabelFillColor = this.VertexLabelFillColor;
        oCopy.VertexLabelPosition = this.VertexLabelPosition;
        oCopy.VertexLabelMaximumLength = this.VertexLabelMaximumLength;
        oCopy.VertexLabelWrapText = this.VertexLabelWrapText;
        oCopy.VertexLabelWrapMaxTextWidth = this.VertexLabelWrapMaxTextWidth;
        oCopy.EdgeLabelTextColor = this.EdgeLabelTextColor;
        oCopy.EdgeLabelMaximumLength = this.EdgeLabelMaximumLength;
        oCopy.GroupLabelTextColor = this.GroupLabelTextColor;
        oCopy.GroupLabelTextAlpha = this.GroupLabelTextAlpha;
        oCopy.GroupLabelPosition = this.GroupLabelPosition;

        return (oCopy);
    }