Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Save XML question(drag pictures) (Read 3340 times)
danielli
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Nov 16th, 2006
Save XML question(drag pictures)
Nov 16th, 2006 at 6:02am
Print Post  
Hi Sir,

When I use XmlWriter and writer.Options.WriteImages = true; to save flowchart which including some image shapes(PNG format), that's ok!
But when I load the file again, the image shapes have
black color background, not transparent.  It's suriprise, Why?

Regards,
Daniel
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Save XML question(drag pictures)
Reply #1 - Nov 16th, 2006 at 6:27am
Print Post  
Hi Daniel,

Writing to and reading from XML works fine with my test PNG image. Please email me yours so we can test that here.

Regards,
Stoyan
  
Back to top
 
IP Logged
 
danielli
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Nov 16th, 2006
Re: Save XML question(drag pictures)
Reply #2 - Nov 18th, 2006 at 1:11am
Print Post  
Hi Stoyo,

Attached files are two png format image files.
Could you do a lab using "FCDemo" project?
If you replace MainForm's _dragPicture's Image to attached file,
Drag some repeat to flowchart, then export to xlm file.
If you import xml file again, black color background maybe would appear.

PNG file has been send to your mail box.

Thanks for your help!

Regards,
Daniel
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Save XML question(drag pictures)
Reply #3 - Nov 20th, 2006 at 7:33am
Print Post  
Hi Daniel,

It seems the .NET's PNG encoder requires the original image data to be still around when saving the image.

E.g. if you load the image from a file and save the diagram in binary or XML format, then load the diagram and the background will be transparent. That will also work if you load the image from the application resources, and keep the resource stream opened while the application runs.

If you use the images from a PictureBox, their resource stream will be closed when the PictureBox loads, so serialization won't work as expected.

Another possibility is to create a ShapeTemplate instance for each image and set the ShapeTemplate.Image property. Do that each time your application starts. That will make the flowchart serialize only the shape template id, without encoding the images in binary or XML files at all. That will also help you keep the diagram files smaller.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint