private void BitmapSelector_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
mouse1Down = false;
else if (e.Button == MouseButtons.Right)
mouse2Down = false;
String description = "";
if (Brush == BrushType.Rectangle)
{
if (mouseDownLast.X != -1 && mouseDownLast.Y != -1)
{
Point p = Translate(e.Location);
using (Graphics g = Graphics.FromImage(Layers[SelectionLayerIndex].Image))
{
if (!SelectionBounds.IsEmpty)
g.SetClip(SelectionBounds);
g.CompositingMode = CompositingMode.SourceCopy;
Brush b = new SolidBrush(e.Button == MouseButtons.Left ? SelectionColor : Color.Transparent);
g.FillRectangle(b, Rectangle.FromLTRB(Math.Min(mouseDownLast.X, p.X), Math.Min(mouseDownLast.Y, p.Y), Math.Max(mouseDownLast.X, p.X), Math.Max(mouseDownLast.Y, p.Y)));
b.Dispose();
}
RedrawBrushLayer(new Point(), true);
Redraw();
description = "Rectangle ";
}
}
else if (Brush == BrushType.Fill)
description = "Fill ";
mouseDownLast.X = -1;
mouseDownLast.Y = -1;
OnSelectionChanged(description + (e.Button == MouseButtons.Left ? "Select" : "Deselect"));
if(!cursorVisible)
{
Cursor.Show();
cursorVisible = true;
}
}