I am using an example given by Ventana System for the Vensim Software. The example is a desktop application in C#. I want to take this example to a web version in C#.
Desktop version
VensimDLLWrapper.vensim_show_sketch(1, 1, 100, (long)pictureBox_Sketch.Handle);
Web version
VensimDLLWrapper.vensim_show_sketch(1, 1, 100, (long)Image1.???);
This is my approach: I create a PictureBox like in Desktop application
PictureBox pictureBox_Sketch = new PictureBox();
pictureBox_Sketch.Name = "pictureBox_Sketch";
pictureBox_Sketch.Size = new System.Drawing.Size(1200, 768);
pictureBox_Sketch.TabIndex = 19;
pictureBox_Sketch.TabStop = false;
Then, I put the Image in the Handle.
VensimDLLWrapper.vensim_show_sketch(1, 1, 100, (long)pictureBox_Sketch.Handle);
Then , I copy to the clipboard the Image:
VensimDLLWrapper.vensim_tool_command("EXPORT>SK", (long)pictureBox_Sketch.Handle, 0);
Finally, I Save the Image In the Disk (It is clear that I have to use Server.Map or other)
if (PInvoke.OpenClipboard(pictureBox_Sketch.Handle))
{
if (PInvoke.IsClipboardFormatAvailable(14))
{
IntPtr ptr = PInvoke.GetClipboardData(14);
if (!ptr.Equals(new IntPtr(0)))
{
Metafile metafile = new Metafile(ptr, true);
metafile.Save("C:\\ruta\\Images\\ModelGraph.png", System.Drawing.Imaging.ImageFormat.Png);
//HyperLink1.NavigateUrl = "Images\\ModelGraph.png";
// Image1.ImageUrl = "Images\\ModelGraph.emf";
//Set the Image Property of PictureBox
}
}
PInvoke.CloseClipboard();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.