单击按钮时,我的程序会捕获图表的屏幕截图,标题为“chartMain”。代码如下:
private void buttonScreenshot_Click(object sender, EventArgs e)
{
this.chartMain.SaveImage("C:/capture.png", ChartImageFormat.Png);
}
但是,这不允许用户指定保存位置,因此我想知道如何实现 SaveFileDialog 以允许用户选择保存位置。
有人可以为我指出正确的方向吗,因为我目前陷入困境。
提前谢谢您。
最佳答案
一个简单的例子,根据您的需要进行修改(不过我会查看 this 页面):
var save = new SaveFileDialog();
save.Filter = "PNG files (*.png)|*.txt|All files (*.*)|*.*";
if(save.ShowDialog() == DialogResult.OK)
{
this.chartMain.SaveImage(save.FileName, ChartImageFormat.Png);
}
关于c# - 使用 SaveFileDialog 保存图表图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43097404/