Inheritance: GraphImageUserSettingsBase
コード例 #1
0
    //*************************************************************************
    //  Constructor: GraphImageUserSettingsDialog()
    //
    /// <summary>
    /// Initializes a new instance of the <see
    /// cref="GraphImageUserSettingsDialog" /> class.
    /// </summary>
    ///
    /// <param name="graphImageUserSettings">
    /// The object being edited.
    /// </param>
    ///
    /// <param name="nodeXLControlSizePx">
    /// The size of the NodeXLControl, in pixels.
    /// </param>
    //*************************************************************************

    public GraphImageUserSettingsDialog
    (
        GraphImageUserSettings graphImageUserSettings,
        Size nodeXLControlSizePx
    )
    {
        Debug.Assert(graphImageUserSettings != null);
        graphImageUserSettings.AssertValid();
        Debug.Assert(nodeXLControlSizePx.Width >= 0);
        Debug.Assert(nodeXLControlSizePx.Height >= 0);

        InitializeComponent();

        m_oGraphImageUserSettings = graphImageUserSettings;
        m_oNodeXLControlSizePx = nodeXLControlSizePx;
        m_bCalculatingHeightOrWidth = false;

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

        m_oGraphImageUserSettingsDialogUserSettings =
            new GraphImageUserSettingsDialogUserSettings(this);

        m_oHeaderFooterFont = m_oGraphImageUserSettings.HeaderFooterFont;

        lblControlWidth.Text =
            nodeXLControlSizePx.Width.ToString(ExcelTemplateForm.Int32Format);

        lblControlHeight.Text =
            nodeXLControlSizePx.Height.ToString(ExcelTemplateForm.Int32Format);

        DoDataExchange(false);

        AssertValid();
    }
コード例 #2
0
        //*************************************************************************
        //  Constructor: GraphImageUserSettingsDialog()
        //
        /// <summary>
        /// Initializes a new instance of the <see
        /// cref="GraphImageUserSettingsDialog" /> class.
        /// </summary>
        ///
        /// <param name="graphImageUserSettings">
        /// The object being edited.
        /// </param>
        ///
        /// <param name="nodeXLControlSizePx">
        /// The size of the NodeXLControl, in pixels.
        /// </param>
        //*************************************************************************

        public GraphImageUserSettingsDialog
        (
            GraphImageUserSettings graphImageUserSettings,
            Size nodeXLControlSizePx
        )
        {
            Debug.Assert(graphImageUserSettings != null);
            graphImageUserSettings.AssertValid();
            Debug.Assert(nodeXLControlSizePx.Width >= 0);
            Debug.Assert(nodeXLControlSizePx.Height >= 0);

            InitializeComponent();

            m_oGraphImageUserSettings   = graphImageUserSettings;
            m_oNodeXLControlSizePx      = nodeXLControlSizePx;
            m_bCalculatingHeightOrWidth = false;

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

            m_oGraphImageUserSettingsDialogUserSettings =
                new GraphImageUserSettingsDialogUserSettings(this);

            m_oHeaderFooterFont = m_oGraphImageUserSettings.HeaderFooterFont;

            lblControlWidth.Text =
                nodeXLControlSizePx.Width.ToString(ExcelTemplateForm.Int32Format);

            lblControlHeight.Text =
                nodeXLControlSizePx.Height.ToString(ExcelTemplateForm.Int32Format);

            DoDataExchange(false);

            AssertValid();
        }
コード例 #3
0
    SaveImage()
    {
        AssertValid();

        if (oNodeXLControl.IsLayingOutGraph)
        {
            return;
        }

        // Get the size of the image.

        GraphImageUserSettings oGraphImageUserSettings =
            new GraphImageUserSettings();

        Int32 iWidth, iHeight;

        if (oGraphImageUserSettings.UseControlSize)
        {
            Size oNodeXLControlSizePx = ehNodeXLControlHost.ClientSize;
            iWidth = oNodeXLControlSizePx.Width;
            iHeight = oNodeXLControlSizePx.Height;

            if (iWidth == 0 || iHeight == 0)
            {
                // The size is unusable.

                FormUtil.ShowWarning(
                    "The graph is too small to save.  Make the graph window"
                    + " larger."
                    );

                return;
            }
        }
        else
        {
            Size oImageSize = oGraphImageUserSettings.ImageSize;
            iWidth = oImageSize.Width;
            iHeight = oImageSize.Height;
        }

        if (m_oSaveGraphImageFileDialog == null)
        {
            m_oSaveGraphImageFileDialog =
                new SaveGraphImageFileDialog(String.Empty, "GraphImage");

            m_oSaveGraphImageFileDialog.DialogTitle = "Save Image to File";
        }

        Boolean bIncludeHeader = oGraphImageUserSettings.IncludeHeader;
        Boolean bIncludeFooter = oGraphImageUserSettings.IncludeFooter;

        Debug.Assert(!bIncludeHeader ||
            oGraphImageUserSettings.HeaderText != null);

        Debug.Assert(!bIncludeFooter ||
            oGraphImageUserSettings.FooterText != null);

        m_oSaveGraphImageFileDialog.ShowDialogAndSaveGraphImage(
            oNodeXLControl, iWidth, iHeight,
            bIncludeHeader ? oGraphImageUserSettings.HeaderText : null,
            bIncludeFooter ? oGraphImageUserSettings.FooterText : null,
            oGraphImageUserSettings.HeaderFooterFont, GetLegendControls()
            );
    }
コード例 #4
0
    SetImageOptions()
    {
        AssertValid();

        if (oNodeXLControl.IsLayingOutGraph)
        {
            return;
        }

        // Allow the user to edit the graph image settings.

        GraphImageUserSettings oGraphImageUserSettings =
            new GraphImageUserSettings();

        Size oNodeXLControlSizePx = ehNodeXLControlHost.ClientSize;

        GraphImageUserSettingsDialog oGraphImageUserSettingsDialog =
            new GraphImageUserSettingsDialog(oGraphImageUserSettings,
                oNodeXLControlSizePx);

        if (oGraphImageUserSettingsDialog.ShowDialog() == DialogResult.OK)
        {
            // Save the new settings.

            oGraphImageUserSettings.Save();
        }
    }