ShowDialogAndSaveGraphImage
        (
            ExcelTemplateNodeXLControl nodeXLControl,
            Int32 width,
            Int32 height
        )
        {
            Debug.Assert(nodeXLControl != null);
            Debug.Assert(width > 0);
            Debug.Assert(height > 0);
            AssertValid();

            // Let the base class do most of the work.  The actual saving will be
            // done by SaveObject() in this class.  Wrap the information required
            // by SaveObject().

            GraphImageSource oGraphImageSource = new GraphImageSource();

            oGraphImageSource.NodeXLControl = nodeXLControl;
            oGraphImageSource.Width         = width;
            oGraphImageSource.Height        = height;

            return(ShowDialogAndSaveObject(oGraphImageSource));
        }
        //*************************************************************************
        //  Method: ShowDialogAndSaveGraphImage()
        //
        /// <summary>
        /// Shows the file save dialog and saves the image to the selected file.
        /// </summary>
        ///
        /// <param name="nodeXLControl">
        /// The control the image will come from.
        /// </param>
        ///
        /// <param name="width">
        /// Width of the image to save.  If saving to XPS, the units are 1/100 of
        /// an inch.  Otherwise, the units are pixels.
        /// </param>
        ///
        /// <param name="height">
        /// Height of the image to save.  If saving to XPS, the units are 1/100 of
        /// an inch.  Otherwise, the units are pixels.
        /// </param>
        ///
        /// <returns>
        /// DialogResult.OK if the user selected a file name and the image was
        /// successfully saved.
        /// </returns>
        ///
        /// <remarks>
        /// This method allows the user to select an image file name and format.
        /// It then saves the image in the selected format.
        /// </remarks>
        //*************************************************************************
        public DialogResult ShowDialogAndSaveGraphImage(
            ExcelTemplateNodeXLControl nodeXLControl,
            Int32 width,
            Int32 height
            )
        {
            Debug.Assert(nodeXLControl != null);
            Debug.Assert(width > 0);
            Debug.Assert(height > 0);
            AssertValid();

            // Let the base class do most of the work.  The actual saving will be
            // done by SaveObject() in this class.  Wrap the information required
            // by SaveObject().

            GraphImageSource oGraphImageSource = new GraphImageSource();

            oGraphImageSource.NodeXLControl = nodeXLControl;
            oGraphImageSource.Width = width;
            oGraphImageSource.Height = height;

            return ( ShowDialogAndSaveObject(oGraphImageSource) );
        }
Example #3
0
        //*************************************************************************
        //  Method: CreateNodeXLControl()
        //
        /// <summary>
        /// Creates a NodeXLControl, hooks up its events, and assigns it as the
        /// child of an ElementHost.
        /// </summary>
        ///
        /// <param name="oGeneralUserSettings">
        /// The user's general settings.
        /// </param>
        //*************************************************************************
        protected void CreateNodeXLControl(
            GeneralUserSettings oGeneralUserSettings
            )
        {
            Debug.Assert(oGeneralUserSettings != null);

            // AssertValid();

            // Control hierarchy:
            //
            // 1. ehElementHost contains a NodeXLWithAxesControl.
            //
            // 2. The NodeXLWithAxesControl contains an ExcelTemplateNodeXLControl.
            //
            // 3. The ExcelTemplateNodeXLControl is derived from NodeXLControl.

            oNodeXLControl = new ExcelTemplateNodeXLControl();

            m_oNodeXLWithAxesControl = new NodeXLWithAxesControl(oNodeXLControl);
            m_oNodeXLWithAxesControl.ShowAxes = oGeneralUserSettings.ShowGraphAxes;

            oNodeXLControl.SelectionChanged +=
            new System.EventHandler(this.oNodeXLControl_SelectionChanged);

            oNodeXLControl.VerticesMoved += new VerticesMovedEventHandler(
            this.oNodeXLControl_VerticesMoved);

            oNodeXLControl.GraphMouseUp += new GraphMouseButtonEventHandler(
            this.oNodeXLControl_GraphMouseUp);

            oNodeXLControl.LayingOutGraph += new System.EventHandler(
            this.oNodeXLControl_LayingOutGraph);

            oNodeXLControl.GraphLaidOut += new AsyncCompletedEventHandler(
            this.oNodeXLControl_GraphLaidOut);

            ehNodeXLControlHost.Child = m_oNodeXLWithAxesControl;
        }