Hi, I has a diagram, and use ExportToImage method to export to png, but the png file is 0KB, and can't diaplay in windows photo viewer, why?
The code is:
namespace OpenDiagramdemo
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public RadDiagram diagram;
public MainWindow()
{
InitializeComponent();
diagram = new RadDiagram();
//the shapes up to 500, display is slow
for(int i = 0; i < 1000; i++)
{
RadDiagramShape s = new RadDiagramShape();
s.Stroke = Brushes.Red;
s.BorderBrush = Brushes.Red;
s.StrokeThickness = 2;
s.IsEditable = false;
s.Foreground = Brushes.Transparent;
s.Background = Brushes.Transparent;
s.Width = 113;
s.Height = 76;
s.X = i;
s.Y = i;
s.Geometry = ShapeFactory.GetShapeGeometry(CommonShapeType.EllipseShape);//"M0.5,0.5L111.5,0.5 111.5,74.5 0.5,74.5z"
diagram.AddShape(s);
}
}
private void MenuItem_Click(object sender, RoutedEventArgs e)
{
FileStream fs = File.Open("D:\\\\tt.png", FileMode.Create);
this.diagram.ExportToImage(fs);
fs.Close();
}
}
}
When run this program, make a diagram And draw a menu in xaml. Define the menu click event MenuItem_Click. Click menu and see the result described above.
Thanks!