如何在csharp中保存Viso绘图 [英] How can save Viso drawing in csharp
本文介绍了如何在csharp中保存Viso绘图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚创建了一个自定义版本的VISIO应用程序.这里可以使用Viso Drawing Control绘制符号,但是我想将此图形保存到图像文件中.
我该怎么做?代码如下:
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:
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
}
}
}
推荐答案
尝试使用System.Drawing
命名空间的image.Save
方法-
http://msdn.microsoft.com/en-us/library/9t4syfhh.aspx [ ^ ].
Try using theimage.Save
method of theSystem.Drawing
namespace -
http://msdn.microsoft.com/en-us/library/9t4syfhh.aspx[^].
这篇关于如何在csharp中保存Viso绘图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文