Inheritance: NodeXLApplicationSettingsBase
        public LayoutControl()
        {
            InitializeComponent();

            GeneralUserSettings oGeneralUserSettings = new GeneralUserSettings();
            oGeneralUserSettings.NotUseWorkbookSettings();
            LayoutUserSettings oLayoutUserSettings = new LayoutUserSettings();
            oLayoutUserSettings.NotUseWorkbookSettings();

            LayoutType eInitialLayout = oLayoutUserSettings.Layout;
//            LayoutType eInitialLayout = LayoutType.FruchtermanReingold;

            // Instantiate an object that populates the tssbLayout
            // ToolStripSplitButton and handles its LayoutChanged event.

            m_oLayoutManagerForToolStripSplitButton =
                new LayoutManagerForToolStripSplitButton();

            m_oLayoutManagerForToolStripSplitButton.AddItems(this.tssbLayout);
            m_oLayoutManagerForToolStripSplitButton.Layout = eInitialLayout;
            m_oLayoutManagerForToolStripSplitButton.LayoutChanged +=
                new EventHandler(
                    this.LayoutManagerForToolStripSplitButton_LayoutChanged);

            CreateNodeXLControl();
            CreateGraphZoomAndScaleControl();

            ApplyGeneralUserSettings(oGeneralUserSettings);
            ApplyLayoutUserSettings(oLayoutUserSettings);

            AssertValid();
        }
 public void CheckDefaultSettings()
 {
     m_GeneralUserSettings = new GeneralUserSettings();
     Assert.AreEqual(m_GeneralUserSettings.NewWorkbookGraphDirectedness, GraphDirectedness.Undirected);
     Assert.AreEqual(m_GeneralUserSettings.ReadVertexLabels, true);
     String labelSettings = (GeneralUserSettings.DefaultFont +
                             "\tWhite\tBottomCenter\t2147483647\t2147483647\tBlack" +
                             "\tTrue\t200\tBlack\t86\tMiddleCenter");
     var conv = new LabelUserSettingsTypeConverter();
     var lab = (LabelUserSettings) conv.ConvertFrom(labelSettings);
     Assert.AreEqual(conv.ConvertTo(m_GeneralUserSettings.LabelUserSettings, typeof(String)), labelSettings);
 }
    //*************************************************************************
    //  Constructor: GeneralUserSettingsDialog()
    //
    /// <summary>
    /// Initializes a new instance of the <see
    /// cref="GeneralUserSettingsDialog" /> class.
    /// </summary>
    ///
    /// <param name="generalUserSettings">
    /// The object being edited.
    /// </param>
    ///
    /// <param name="workbook">
    /// Workbook containing the graph data.
    /// </param>
    //*************************************************************************

    public GeneralUserSettingsDialog
    (
        GeneralUserSettings generalUserSettings//,
//       Microsoft.Office.Interop.Excel.Workbook workbook
    )
    {
        Debug.Assert(generalUserSettings != null);
//        Debug.Assert(workbook != null);
        generalUserSettings.AssertValid();

        m_oGeneralUserSettings = generalUserSettings;
//        m_oWorkbook = workbook;
        m_oAxisFont = m_oGeneralUserSettings.AxisFont;
        m_oLabelUserSettings = m_oGeneralUserSettings.LabelUserSettings;

        m_oOpenFileDialog = new OpenFileDialog();

        m_oOpenFileDialog.Filter =
            "All files (*.*)|*.*|" + SaveableImageFormats.Filter
            ;

        m_oOpenFileDialog.Title = "Browse for Background Image";

        // 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_oGeneralUserSettingsDialogUserSettings =
            new GeneralUserSettingsDialogUserSettings(this);

        InitializeComponent();

        nudEdgeWidth.Minimum =
            (Decimal)EdgeWidthConverter.MinimumWidthWorkbook;

        nudEdgeWidth.Maximum =
            (Decimal)EdgeWidthConverter.MaximumWidthWorkbook;

        nudRelativeArrowSize.Minimum =
            (Decimal)EdgeDrawer.MinimumRelativeArrowSize;

        nudRelativeArrowSize.Maximum =
            (Decimal)EdgeDrawer.MaximumRelativeArrowSize;

        cbxEdgeBezierDisplacementFactor.PopulateWithObjectsAndText(
            0.1, "Low",
            0.2, "Medium",
            0.6, "High",
            1.2, "Very High"
            );

        cbxEdgeBundlerStraightening.PopulateWithObjectsAndText(
            0.15F, "Tight",
            0.40F, "Medium",
            0.60F, "Loose"
            );

        nudVertexRadius.Minimum = nudVertexImageSize.Minimum =
            (Decimal)VertexRadiusConverter.MinimumRadiusWorkbook;

        nudVertexRadius.Maximum = nudVertexImageSize.Maximum =
            (Decimal)VertexRadiusConverter.MaximumRadiusWorkbook;

        ( new VertexShapeConverter() ).PopulateComboBox(cbxVertexShape, false);

        nudVertexAlpha.Minimum = nudEdgeAlpha.Minimum =
            (Decimal)AlphaConverter.MinimumAlphaWorkbook;

        nudVertexAlpha.Maximum = nudEdgeAlpha.Maximum =
            (Decimal)AlphaConverter.MaximumAlphaWorkbook;

        nudVertexRelativeOuterGlowSize.Minimum =
            (Decimal)VertexDrawer.MinimumRelativeOuterGlowSize;

        nudVertexRelativeOuterGlowSize.Maximum =
            (Decimal)VertexDrawer.MaximumRelativeOuterGlowSize;

        DoDataExchange(false);

        AssertValid();
    }
        protected void ShowGraph(Boolean bLayOutGraph)
//        public void ShowGraph(Boolean bLayOutGraph)
        {
            AssertValid();

            if (m_oNodeXLControl.IsLayingOutGraph)
            {
                return;
            }
            GeneralUserSettings oGeneralUserSettings = new GeneralUserSettings();
            oGeneralUserSettings.NotUseWorkbookSettings();
            LayoutUserSettings oLayoutUserSettings = new LayoutUserSettings();
            oLayoutUserSettings.NotUseWorkbookSettings();

            ApplyGeneralUserSettings(oGeneralUserSettings);
            ApplyLayoutUserSettings(oLayoutUserSettings);
            EnableGraphControls(false);

            try
            {
//                IGraphAdapter oGraphAdapter = new SimpleGraphAdapter();
//                m_oNodeXLControl.Graph = oGraphAdapter.LoadGraphFromFile(
//                    "..\\..\\SampleGraph.txt");

                //IGraph oGraph = oWorkbookReader.ReadWorkbook(
                //    m_oWorkbook, oReadWorkbookContext);

                // Load the NodeXLControl with the resulting graph.

                //m_oNodeXLControl.Graph = oGraph;

                // Collapse any groups that are supposed to be collapsed.

                //CollapseOrExpandGroups(GetGroupNamesToCollapse(oGraph), true,
                //    false);

                // Enable tooltips in case tooltips were specified in the workbook.

                m_oNodeXLControl.ShowVertexToolTips = true;

                // If the dynamic filter dialog is open, read the dynamic filter
                // columns it filled in.

                m_oNodeXLControl.DrawGraph(bLayOutGraph);

            }
            catch (Exception oException)
            {
                // If exceptions aren't caught here, Excel consumes them without
                // indicating that anything is wrong.  This can result in the graph
                // controls remaining disabled, among other problems.

                //ErrorUtil.OnException(oException);
            }
            finally
            {
                EnableGraphControls(true);
            }

            // Change the button text to indicate that if any of the buttons is
            // clicked again, the graph will be read again.

            tsbShowGraph.Text = "Refresh Graph";

        }
        EditGeneralUserSettings()
        {
            AssertValid();

            if (m_oNodeXLControl.IsLayingOutGraph)
            {
                return;
            }

            GeneralUserSettings oGeneralUserSettings = new GeneralUserSettings();
            oGeneralUserSettings.NotUseWorkbookSettings();

            GeneralUserSettingsDialog oGeneralUserSettingsDialog =
                new GeneralUserSettingsDialog(oGeneralUserSettings);

            if (oGeneralUserSettingsDialog.ShowDialog() == DialogResult.OK)
            {
                oGeneralUserSettings.Save();
                ApplyGeneralUserSettings(oGeneralUserSettings);
                m_oNodeXLControl.DrawGraph();
            }
        }
        ApplyGeneralUserSettings
        (
            GeneralUserSettings oGeneralUserSettings
        )
        {
            Debug.Assert(oGeneralUserSettings != null);
            AssertValid();

            oGeneralUserSettings.TransferToNodeXLWithAxesControl(
                m_oNodeXLWithAxesControl);
        }