Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I just created a application the custom version of VISIO .Here a can draw the symbols using Viso Drawing Control but i want to save this drawing into a image file.

How can I do it? Code is given below:
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Office.Interop.Visio;
using System.Collections;

namespace SmartUML
{
    public partial class frmCanvas : Form
    {
        Document currentStencil,p;
        Window stencilWindow,d;
        public frmCanvas()
        {
            InitializeComponent();
        }

        private void frmCanvas_Load(object sender, EventArgs e)

        {
            string ApplicationPath = System.Windows.Forms.Application.StartupPath + @"\Umls\";
            Microsoft.Office.Interop.Visio.Application app = this.axDrawingControl1.Document.Application;
            app.Addons.Add(ApplicationPath + "\\UML.VSL");  
            app.Documents.Add(ApplicationPath + "\\UMLMOD_U.VST"); 
            DrawCurrentShape(CoreLib.CurrentFile);
        }
       

        public void DrawCurrentShape(string currentSelection)
        {
            string ApplicationPath = System.Windows.Forms.Application.StartupPath + @"\Umls\";

            currentStencil = axDrawingControl1.Document.Application.Documents.OpenEx(currentSelection, (short)VisOpenSaveArgs.visOpenDocked);
            Page currentPage = axDrawingControl1.Document.Pages[1];
            stencilWindow = currentPage.Document.OpenStencilWindow();
        }

        private void frmCanvas_FormClosed(object sender, FormClosedEventArgs e)
        {
            System.Windows.Forms.Application.Exit();
        }

        private void saveToolStripMenuItem1_Click(object sender, EventArgs e)
        {
           // Here i want to write the code for Saving
        }
    }
}
Posted
Updated 4-May-11 20:56pm
v2

1 solution

Try using the image.Save method of the System.Drawing namespace -
http://msdn.microsoft.com/en-us/library/9t4syfhh.aspx[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900