private void newFile() { using (var d = new NewFileDialog()) { d.ShowDialog(); if (d.DialogResult == DialogResult.OK) { pictureBox1.Width = d.ImgWidth; pictureBox1.Height = d.ImgHeight; pictureBox1.Image = new Bitmap(pictureBox1.Width, pictureBox1.Height); pictureBox1.DrawToBitmap( (Bitmap)pictureBox1.Image, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height)); pictureBox1.Visible = true; openedFileName = null; isSaved = false; } } }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { using (var d = new NewFileDialog()) { d.ShowDialog(); if (d.DialogResult == DialogResult.OK) { pictureBox1.Width = d.ImgWidth; pictureBox1.Height = d.ImgHeight; _image = new Bitmap(d.ImgWidth, d.ImgHeight); pictureBox1.Image = _image; pictureBox1.DrawToBitmap( (Bitmap)pictureBox1.Image, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height)); pictureBox1.Visible = true; openedFileName = null; isSaved = false; checkedListBox1.Items.Clear(); //drawImages(); } } }