C#中saveFileDialog的操作
this.saveFileDialog.Title="保存为";this.saveFileDialog.InitialDirectory=Application.Star...
this.saveFileDialog.Title = "保存为";
this.saveFileDialog.InitialDirectory = Application.StartupPath + @"..\..\图片";
this.saveFileDialog.FileName = "";
saveFileDialog.RestoreDirectory = true;
this.saveFileDialog.Filter = "图片(.png)|*.png";
if (this.saveFileDialog.ShowDialog() == DialogResult.OK)
{
Bitmap bit = new Bitmap(this.Width, this.Height);//实例化一个和窗体一样大的bitmap
Graphics g = Graphics.FromImage(bit);
g.CompositingQuality = CompositingQuality.HighQuality;//质量设为最高
g.CopyFromScreen(this.Left, this.Top, 0, 0, new Size(this.Width, this.Height));//保存整个窗体为图片
}
else
{
MessageBox.Show("保存失败");
return;
}
怎么不可以存 展开
this.saveFileDialog.InitialDirectory = Application.StartupPath + @"..\..\图片";
this.saveFileDialog.FileName = "";
saveFileDialog.RestoreDirectory = true;
this.saveFileDialog.Filter = "图片(.png)|*.png";
if (this.saveFileDialog.ShowDialog() == DialogResult.OK)
{
Bitmap bit = new Bitmap(this.Width, this.Height);//实例化一个和窗体一样大的bitmap
Graphics g = Graphics.FromImage(bit);
g.CompositingQuality = CompositingQuality.HighQuality;//质量设为最高
g.CopyFromScreen(this.Left, this.Top, 0, 0, new Size(this.Width, this.Height));//保存整个窗体为图片
}
else
{
MessageBox.Show("保存失败");
return;
}
怎么不可以存 展开
展开全部
你根本就没写保存代码怎么存,在
g.CopyFromScreen(this.Left, this.Top, 0, 0, new Size(this.Width, this.Height));//保存整个窗体为图片
后面加一行
g.CopyFromScreen(this.Left, this.Top, 0, 0, new Size(this.Width, this.Height));//保存整个窗体为图片
bit.Save(saveFileDialog.FileName,System.Drawing.Imaging.ImageFormat.Png);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询