private void MPicBox_MouseUp(object sender, MouseEventArgs e) { mPicBox.Controls.Remove(subPB); MPicBoxUpdate(); subPB.Dispose(); subPB = null; }
private void MPicBox_MouseDown(object sender, MouseEventArgs e) { subPB = new DoubleBufferPictureBox(); subPB.Location = new Point(0, 0); subPB.Size = mPicBox.Size; subPB.BackColor = Color.Transparent; mPicBox.Controls.Add(subPB); switch (currentTool) { case Tool.pen: { pen.GetLocation(ref e); processing = new Bitmap(bmpSize.Width, bmpSize.Height); } break; case Tool.picker: { mainColorPic.BackColor = picker.GetColor(ref finalBmp, ref e); } break; default: break; } }
private void CloseToolStripMenuItem_Click(object sender, EventArgs e) { if (working) { if (!saved) { DialogResult dialog = MessageBox.Show(filename + " haven't saved yet.\nDo you want to save it", "Photo Editor", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (dialog == DialogResult.Yes) { SaveToolStripMenuItem_Click(sender, e); } } layerPanel.Enabled = false; finalBmp.Dispose(); mPicBox.Dispose(); mPicBox = null; workPanel.Controls.Remove(mPicBox); layerContainer.Dispose(); layerContainer = null; layerPanel.Controls.Remove(layerContainer); working = false; } }
private void MPicBoxInit() { if (mPicBox == null) { mPicBox = new DoubleBufferPictureBox(); mPicBox.Location = new System.Drawing.Point(0, 0); mPicBox.Name = "mPicBox"; mPicBox.Size = bmpSize; mPicBox.Image = finalBmp; mPicBox.MouseDown += MPicBox_MouseDown; mPicBox.MouseLeave += MPicBox_MouseLeave; mPicBox.MouseMove += MPicBox_MouseMove; mPicBox.MouseUp += MPicBox_MouseUp; workPanel.Controls.Add(mPicBox); } }