private void timerSet_Tick(object sender, EventArgs e)
{
if (buttonCover.Checked || buttonCrop.Checked) {
this.boxPreview.Location = new Point(this.previewRect.X + this.Stage.Left, this.previewRect.Y + this.Stage.Top);
this.boxPreview.Size = this.previewRect.Size;
if (this.previewRect.Width > 0 && this.previewRect.Height > 0) {
Bitmap rectBmp = new Bitmap(this.previewRect.Width, this.previewRect.Height);
Graphics rectGfx = Graphics.FromImage(rectBmp);
rectGfx.DrawImage(this.img, new Rectangle(0, 0, this.previewRect.Width, this.previewRect.Height), this.previewRect, GraphicsUnit.Pixel);
Pen rectPen = new Pen(this.currentColor, 5);
rectGfx.DrawRectangle(rectPen, new Rectangle(0, 0, this.previewRect.Width, this.previewRect.Height));
this.boxPreview.Image = rectBmp;
}
}
if (buttonDraw.Checked) {
if (this.drawLines.Count > 1) {
g.DrawLines(new Pen(this.currentColor, 4), this.drawLines.ToArray());
Point lastPoint = this.drawLines.Last();
this.drawLines.Clear();
this.drawLines.Add(lastPoint);
}
}
this.Stage.Image = img;
}