public FrmMain() { InitializeComponent(); this.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); currentshape = ShapesTypes.ShapeTypes.CropRect; this.DoubleBuffered = true; ContextMenuSelectColor.ColorScheme = ComponentFactory.Krypton.Toolkit.ColorScheme.OfficeStandard; ContextMenuSelectColor.SelectedColor = Color.Red; BtnColor.ForeColor = SelectedColor; OriginalScreenImage = AssistOperation.CaptureScreen(); cropRect = new CropRect(new Rectangle(-5, -5, 1, 1)); cropRect.SetForm(this); cropRect.Visible = true; cropRect.RectMoved += CropRect_RectMoved; this.BackgroundImage = AssistOperation.FadeImage(OriginalScreenImage); this.BackgroundImageLayout = ImageLayout.Center; undoactions = new UndoRedo(); }
private void FrmMain_MouseDown(object sender, MouseEventArgs e) { if (currentshape == ShapesTypes.ShapeTypes.Undo) { currentshape = oldshape; } StartPoint.X = e.X; StartPoint.Y = e.Y; }
private void BtnUndo_Click(object sender, EventArgs e) { if (currentshape != ShapesTypes.ShapeTypes.Undo) { oldshape = currentshape; currentshape = ShapesTypes.ShapeTypes.Undo; } if (undoactions.lstShape.Count > 0) { undoactions.Undo(); this.Invalidate(); } }
private void FrmMain_MouseUp(object sender, MouseEventArgs e) { if (currentshape == ShapesTypes.ShapeTypes.CropRect) { currentshape = ShapesTypes.ShapeTypes.None; MainToolBar.Visible = true; } if (MainToolBar.Visible == false) { MainToolBar.Visible = true; } if (currentshape == ShapesTypes.ShapeTypes.Line) { Shape shape = new Shape(); shape.shape = ShapesTypes.ShapeTypes.Line; shape.X = StartPoint.X; shape.Y = StartPoint.Y; shape.Width = EndPoint.X; shape.Height = EndPoint.Y; shape.pen = pen; undoactions.AddShape(shape); } else if (currentshape == ShapesTypes.ShapeTypes.Arrow) { Shape shape = new Shape(); shape.shape = ShapesTypes.ShapeTypes.Arrow; shape.X = StartPoint.X; shape.Y = StartPoint.Y; shape.Width = EndPoint.X; shape.Height = EndPoint.Y; shape.pen = pen; undoactions.AddShape(shape); } else if (currentshape == ShapesTypes.ShapeTypes.Rectangle) { Shape shape = new Shape(); shape.shape = ShapesTypes.ShapeTypes.Rectangle; shape.X = RectShape.X; shape.Y = RectShape.Y; shape.Width = RectShape.Width; shape.Height = RectShape.Height; shape.pen = pen; undoactions.AddShape(shape); } this.Invalidate(); }
private void BtnLine_Click(object sender, EventArgs e) { currentshape = ShapesTypes.ShapeTypes.Line; BtnArrow.Checked = BtnRect.Checked = BtnCropRect.Checked = !BtnLine.Checked; cropRect.AllowMovementAndResize = false; }