コード例 #1
0
        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();
        }
コード例 #2
0
        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";

        }
コード例 #3
0
        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();
            }
        }