Esempio n. 1
0
 private void button_save_image_Click(object sender, EventArgs e)
 {
     if (RoomMaker.checkValid())
     {
         Bitmap bmp = new Bitmap(panel_canvas.Width, panel_canvas.Height);
         panel_canvas.DrawToBitmap(bmp, new Rectangle(0, 0, panel_canvas.Width, panel_canvas.Height));
         saveFileDialog1.Filter           = "png files (*.png)|*.png|jpeg files (*.jpeg)|*.jpeg";
         saveFileDialog1.FilterIndex      = 2;
         saveFileDialog1.RestoreDirectory = true;
         if (saveFileDialog1.ShowDialog() == DialogResult.OK)
         {
             int idx = saveFileDialog1.FilterIndex;
             if (idx == 1)
             {
                 bmp.Save(saveFileDialog1.FileName, ImageFormat.Png);
             }
             else
             {
                 bmp.Save(saveFileDialog1.FileName, ImageFormat.Jpeg);
             }
         }
     }
     else
     {
         MessageBox.Show("닫힌 공간이 존재합니다.");
     }
 }