Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) From FlowChart.NET.dll to WebChart.NET.dll (Read 7510 times)
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
From FlowChart.NET.dll to WebChart.NET.dll
Sep 10th, 2007 at 5:33am
Print Post  
Hi stoyo.

I created an Xml Schema of the workflow rapresented in a FlowChart with Xml.XmlWriter.
After, i create WebApplication for rapresent this Workflow. To do this i use MindFusion.WebChart.Xml.XmlReader class. Workflow will rapresented correctly, but all boxes lose their formatting: the icon have black backcolor and boxes' text is non at the same position i set previously.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: From FlowChart.NET.dll to WebChart.NET.dll
Reply #1 - Sep 10th, 2007 at 7:23am
Print Post  
Hi Alesdario,

Have you enabled the XmlWriter.Options.WriteImages property?

Stoyan
  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: From FlowChart.NET.dll to WebChart.NET.dll
Reply #2 - Sep 10th, 2007 at 7:47am
Print Post  
Yes. I've enabled that.
I've checked and i notice that boxes lose only their formatting and icon are rapresented differently by old configuration (Icons'  background color is Transparent in the old configuration and black in the new configuration)

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: From FlowChart.NET.dll to WebChart.NET.dll
Reply #3 - Sep 10th, 2007 at 8:08am
Print Post  
What image format are you using? The .NET image encoders often require access to the original file or stream to preserve all of the image data. So when creating the diagram that you save with XmlWriter, try to keep the image files around, or do node close the stream from where you are loading the images.

Stoyan
  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: From FlowChart.NET.dll to WebChart.NET.dll
Reply #4 - Sep 10th, 2007 at 8:32am
Print Post  
I use *.ico images.

Tanks.
  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: From FlowChart.NET.dll to WebChart.NET.dll
Reply #5 - Sep 10th, 2007 at 8:37am
Print Post  
Smiley Smiley Smiley
Stoyo wrote on Sep 10th, 2007 at 8:08am:
do node close the stream from where you are loading the images


How can i do this?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: From FlowChart.NET.dll to WebChart.NET.dll
Reply #6 - Sep 10th, 2007 at 11:02am
Print Post  
It depends. Where are you loading the icons from?
  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: From FlowChart.NET.dll to WebChart.NET.dll
Reply #7 - Sep 10th, 2007 at 11:08am
Print Post  
In the first diagram, the icon are loaded from a resources file. The icon of the second diagram are loaded from the xml.

If you think there is a simple road than mine write me!
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: From FlowChart.NET.dll to WebChart.NET.dll
Reply #8 - Sep 10th, 2007 at 1:03pm
Print Post  
If you are using ResourceManager.GetStream() and then loading an image using Image.FromStream(), then simply not calling stream.Close() is enough to have the image saved correctly later.

Stoyan
  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: From FlowChart.NET.dll to WebChart.NET.dll
Reply #9 - Sep 10th, 2007 at 1:20pm
Print Post  
I'm Sorry. Icon are not loaded from resource file but are stored in a ImageList. I didn't use any stream to load the Icon i link ti my Box... Cry
  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: From FlowChart.NET.dll to WebChart.NET.dll
Reply #10 - Sep 10th, 2007 at 1:50pm
Print Post  
Other then the problem of the Background' color of the icon, there is a other problem: when i create new FlowChart whit XmlReader class, all boxes lose their formatting....why?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: From FlowChart.NET.dll to WebChart.NET.dll
Reply #11 - Sep 10th, 2007 at 4:43pm
Print Post  
It seems you can 't do anything about losing the transparent color when using an image list. Try calling ImageList.Images[0].Save(@"icon1.ico", ImageFormat.Icon) and you will see that the color is not preserved.

An advice in the Image.FromStream topic in MSDN states that "You must keep the stream open for the lifetime of the Image". The probable reason is to use the original data when saving the image, but apparently the image list does not stick to that advice.

As a workaround, you could save the image index in the ImageList as a Box.Tag, and after loading the flowchart from XML, reload the images according to the stored index.

What exactly is lost from the box formatting?

Stoyan
  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: From FlowChart.NET.dll to WebChart.NET.dll
Reply #12 - Sep 11th, 2007 at 5:38am
Print Post  
Box lose this formatting.
Code
Select All
ShapeTemplate newshape =  new ShapeTemplate(
ShapeTemplate.FromId("Rectangle").Outline,
null,
new ElementTemplate[]
   {
   new LineTemplate(0, 50, 100, 50),
   new LineTemplate(100,50,100,100),
   new LineTemplate(100, 100, 0, 100),
   new LineTemplate(0, 100, 0, 50)
   },
FillMode.Winding,   "test" );

newshape.ImageRectangle = new RectangleF(0, 0, 100, 50);
box.Style = BoxStyle.Shape;
box.Shape = newshape;
box.TextFormat.LineAlignment = StringAlignment.Center;
box.TextFormat.Alignment = StringAlignment.Center;
box.Resize(84,60); 


  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: From FlowChart.NET.dll to WebChart.NET.dll
Reply #13 - Sep 11th, 2007 at 5:44am
Print Post  
Stoyo wrote on Sep 10th, 2007 at 4:43pm:
As a workaround, you could save the image index in the ImageList as a Box.Tag, and after loading the flowchart from XML, reload the images according to the stored index.


Your solution if perfect, but i can't use because in my flowchart there are some boxes that are Attached to an arrow. I use TAG for findind the correct box linked to an arrow (i set box' tag like arrow's tag). Is there another way to find the box attached to an arrows without using tag?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: From FlowChart.NET.dll to WebChart.NET.dll
Reply #14 - Sep 11th, 2007 at 7:46am
Print Post  
Use the Arrow.SubordinateGroup.Boxes collection to get the boxes that are attached to an arrow.

The shape definition is not saved in the XML file, but only its id, so you must define the "test" shape in the server application too. Just copy & paste the "new ShapeTemplate" code there.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint