0
我創建了一個分形繪圖程序,並且試圖將按鈕合併到當前位圖中。我使用mandelbrot()方法,但按鈕&代碼似乎不起作用,它只是拋出錯誤。下面是圖&保存位圖的代碼:在GDI +中發生了一個通用錯誤 - 將位圖保存到桌面
我認爲這是因爲文件夾權限,所以我添加了代碼以將其保存到當前用戶的桌面。但仍然是同樣的錯誤。
繪製位圖
private Bitmap picture;
private Graphics g1;
private void Form1_Paint(object sender, PaintEventArgs e)
{
//put the bitmap on the window
Graphics windowG = e.Graphics;
windowG.DrawImageUnscaled(picture, 0, 0);
}
保存位圖
private void savefractal_Click(object sender, EventArgs e)
{
try
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
picture.Save(path);
savefractal.Text = "Saved file.";
}
catch (Exception)
{
MessageBox.Show("There was a problem saving the file." +
" Check the file permissions.");
}
}
傳奇。謝謝:) – user2326995
我會接受這個答案 - 說我必須等待7分鐘 – user2326995