This class extends the SaveImageFileDialog base class by adding an option to save the graph to an XPS file.
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() ); }