下述法典促使用户选择一条从图像Box中挽救形象的道路:
Stream myStream;
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "Portable Network Graphics|*.png";
saveFileDialog1.Title = "Bild speichern";
saveFileDialog1.RestoreDirectory = true;
saveFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
if ((myStream = saveFileDialog1.OpenFile()) != null)
{
this.picBox.Image.Save(myStream.ToString()); // is not getting the selected path
myStream.Close();
}
}
But how can I get the path from myStream or save the image to the user defined location (with compatibility to .NET 3.5)?