Hi,
This stencil contains some embedded EMF images which cannot be rendered by WPF out of the box. You can convert them to WPF ImageSource using code below, and you will also need to add System.Drawing.dll as reference to your project.
private static ImageSource CreateImage(Stream stream)
{
var image = new System.Drawing.Imaging.Metafile(stream);
const int size = 256;
using (var bitmap = new System.Drawing.Bitmap(size, size, System.Drawing.Imaging.PixelFormat.Format32bppArgb))
{
using (var graphics = System.Drawing.Graphics.FromImage(bitmap))
{
graphics.DrawImage(image, 0, 0, size, size);
using (var memoryStream = new MemoryStream())
{
bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Png);
var result = new BitmapImage();
result.BeginInit();
result.StreamSource = memoryStream;
result.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
result.CacheOption = BitmapCacheOption.OnLoad;
result.EndInit();
return result;
}
}
}
}
var stencil = VisioStencil.LoadFromXml(fileName, CreateImage);
This build also extends support for cross-shape formula references necessary to render correct heights for the monitor shapes:
https://mindfusion.eu/_beta/vsx_meta.zip Quote:is there an expected date/version for when the import will be improved? I have a large number of visio masters that are not imported correctly at all
While the stencil XML format itself is documented, there are many Visio API functions and objects referenced from shape formulas that are not and we must implement by guesswork. So you will have to send us the stencil files that don't work for our developers to investigate and we'll try to improve.
I hope that helps,
Stoyan