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 LayerRow_Click(object sender, EventArgs e) { LayerContainer layCon = (LayerContainer)Parent.Parent; layCon.CurrentRow = this; Form1 form = (Form1)Parent.Parent.Parent.Parent.Parent; form.LayerButtonCheck(); form.opacityVal = layer.Opacity; form.OpacityBarUpdate(); }
private void LayerContainerInit() { if (layerContainer == null) { layerContainer = new LayerContainer(); layerContainer.AutoScroll = true; layerContainer.Location = new System.Drawing.Point(4, 55); layerContainer.Name = "layerContainer"; layerContainer.Size = new System.Drawing.Size(201, 230); layerPanel.Controls.Add(layerContainer); layerPanel.Enabled = true; opacityVal = 100f; OpacityBarUpdate(); } }
public bool Remove() { if (events.Count == 0) { return(false); } Form1 form = (Form1)Parent.Parent.Parent.Parent; LayerContainer container = (LayerContainer)events.Peek().Value.Parent.Parent; switch (events.Peek().Key) { case HistoryEvent.Draw: case HistoryEvent.DrawFilter: case HistoryEvent.Erase: case HistoryEvent.Clear: case HistoryEvent.Fill: case HistoryEvent.Transform: events.Peek().Value.Layer.UnStacking(); break; case HistoryEvent.NewL: case HistoryEvent.DuplicateL: container.DeleteRowAt(events.Peek().Value); form.LayerButtonCheck(); break; case HistoryEvent.DeleteL: container.RestoreRow(); form.LayerButtonCheck(); break; case HistoryEvent.MergeL: events.Peek().Value.Layer.UnStacking(); container.RestoreRow(); form.LayerButtonCheck(); break; case HistoryEvent.Lup: container.MoveBack(events.Peek().Value, false); break; case HistoryEvent.Ldown: container.MoveBack(events.Peek().Value, true); break; case HistoryEvent.Opacity: events.Peek().Value.Layer.RestoreOpacity(); form.opacityVal = events.Peek().Value.Layer.Opacity; events.Peek().Value.Opacity = events.Peek().Value.Layer.Opacity; form.OpacityBarUpdate(); form.DSUpdate(); break; case HistoryEvent.Blend: events.Peek().Value.RestoreBlend(); form.BlendModeBoxUpdate(events.Peek().Value.Blend); form.DSUpdate(); break; default: break; } events.Pop(); listBox1.Items.RemoveAt(0); return(true); }