//新建空白图片 private void 新建ToolStripMenuItem1_Click(object sender, EventArgs e) { Newbmp newform = new Newbmp(0); this.Visible = false; newform.ShowDialog(); par = newform.Get_par(); newform.Dispose(); this.Visible = true; if (!par.IsEmpty()) { Bmp = new Bitmap(par.Wid, par.Heg);//会出现透明的 if (par.Trfs) { Graphics g = Graphics.FromImage(Bmp); // 根据新建的 Bitmap 位图,创建画布 g.Clear(Color.White); g.Dispose(); } end_Bmp = (Bitmap)Bmp.Clone(); set_name_1("新建图片"); issava.Visible = true; frist_run(); } }
private void 画布ToolStripMenuItem_Click(object sender, EventArgs e) { if (Bmp == null) { return; } Newbmp newform = new Newbmp(1); this.Visible = false; newform.ShowDialog(); par = newform.Get_par(); newform.Dispose(); this.Visible = true; if (par.IsEmpty()) { return; } Bitmap bim = new Bitmap(par.Wid, par.Heg); Graphics g = Graphics.FromImage(bim); g.Clear(Color.White); g.DrawImage(Bmp, new Rectangle(0, 0, par.Wid, par.Heg), new Rectangle(0, 0, par.Wid, par.Heg), GraphicsUnit.Pixel); Bmp = (Bitmap)bim.Clone(); g.Dispose(); bim.Dispose(); set_size(); picBox.Image = Bmp; save_bmp_set(save_bmp, Bmp); issava.Visible = true; }