Esempio n. 1
0
        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);

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

            oLabelUserSettings.VertexLabelFillColor = (Color)
                                                      (new ColorConverter()).ConvertFromString(asStrings[1]);

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

            oLabelUserSettings.VertexLabelMaximumLength =
                Int32.Parse(asStrings[3]);

            oLabelUserSettings.EdgeLabelMaximumLength =
                Int32.Parse(asStrings[4]);

            return(oLabelUserSettings);
        }
Esempio n. 2
0
        ConvertTo
        (
            ITypeDescriptorContext context,
            CultureInfo culture,
            Object value,
            Type destinationType
        )
        {
            Debug.Assert(value != null);
            Debug.Assert(value is LabelUserSettings);
            Debug.Assert(destinationType == typeof(String));
            AssertValid();

            LabelUserSettings oLabelUserSettings = (LabelUserSettings)value;

            // Use a simple tab-delimited format.  Sample string:
            //
            // "Microsoft Sans Serif, 8.25pt\tWhite\tBottomCenter\t2147483647\t
            // 4294967295";

            return(String.Format(CultureInfo.InvariantCulture,

                                 "{0}\t{1}\t{2}\t{3}\t{4}"
                                 ,
                                 (new FontConverter()).ConvertToInvariantString(
                                     oLabelUserSettings.Font),

                                 (new ColorConverter()).ConvertToString(
                                     oLabelUserSettings.VertexLabelFillColor),

                                 oLabelUserSettings.VertexLabelPosition,
                                 oLabelUserSettings.VertexLabelMaximumLength,
                                 oLabelUserSettings.EdgeLabelMaximumLength
                                 ));
        }
Esempio n. 3
0
        //*************************************************************************
        //  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 = 'T';
            usrEdgeLabelMaximumLength.AccessKey   = 'c';

            (new VertexLabelPositionConverter()).PopulateComboBox(
                cbxVertexLabelPosition, false);

            DoDataExchange(false);

            AssertValid();
        }
Esempio n. 4
0
        Copy()
        {
            AssertValid();

            LabelUserSettings oCopy = new LabelUserSettings();

            oCopy.Font = this.Font;
            oCopy.VertexLabelFillColor     = this.VertexLabelFillColor;
            oCopy.VertexLabelPosition      = this.VertexLabelPosition;
            oCopy.VertexLabelMaximumLength = this.VertexLabelMaximumLength;
            oCopy.EdgeLabelMaximumLength   = this.EdgeLabelMaximumLength;

            return(oCopy);
        }