Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic version 5 diagram to emf file (Read 1439 times)
due
YaBB Newbies
*
Offline



Posts: 27
Joined: Jun 20th, 2007
version 5 diagram to emf file
Oct 12th, 2007 at 2:11pm
Print Post  
How can I export a version 5 diagram to emf file:

FlowChart 4.x implementation:
Code
Select All
	using (FileStream stream = new FileStream(path, FileMode.Create)) {
	  Graphics g = diagramView.CreateGraphics();
	  IntPtr hDC = g.GetHdc();
	  Metafile metafile = new Metafile(stream, hDC);
	  g.ReleaseHdc(hDC);
	  g.Dispose();

	  Graphics gMeta = Graphics.FromImage(metafile);
	  Diagram diagram = diagramView.Diagram;
	  gMeta.FillRectangle(new SolidBrush(diagramView.BackColor), diagramView.Bounds);

	  foreach (DiagramItem item in diagram.Items) {
	    if (item.Visible) {

		item.Draw(gMeta, false);  //ERROR!

	    }
	  }

	  gMeta.Dispose();
	  metafile.Dispose();
	}
 

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: version 5 diagram to emf file
Reply #1 - Oct 15th, 2007 at 5:19am
Print Post  
IGraphics gMeta = new GdiGraphics(Graphics.FromImage(metafile));

should work. IGraphics and GdiGraphics are defined in the MindFusion.Drawing namespace.

Stoyan
  
Back to top
 
IP Logged
 
due
YaBB Newbies
*
Offline



Posts: 27
Joined: Jun 20th, 2007
Re: version 5 diagram to emf file
Reply #2 - Oct 29th, 2007 at 7:04am
Print Post  
Thx! It works fine!  Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint