diff --git a/Greenshot/Drawing/CropContainer.cs b/Greenshot/Drawing/CropContainer.cs index 9c25dc251..b68e012d6 100644 --- a/Greenshot/Drawing/CropContainer.cs +++ b/Greenshot/Drawing/CropContainer.cs @@ -39,21 +39,31 @@ namespace Greenshot.Drawing { parent.Invalidate(); } + /// + /// We need to override the DrawingBound, return a rectangle in the size of the image, to make sure this element is always draw + /// (we create a transparent brown over the complete picture) + /// + public override Rectangle DrawingBounds { + get { + return new Rectangle(0,0,parent.Width, parent.Height); + } + } + public override void Draw(Graphics g, RenderMode rm) { using (Brush cropBrush = new SolidBrush(Color.FromArgb(100, 150, 150, 100))) { - Rectangle r = GuiRectangle.GetGuiRectangle(this.Left, this.Top, this.Width, this.Height); - Rectangle selectionRect = new Rectangle(r.Left - 1, r.Top - 1, r.Width + 1, r.Height + 1); + Rectangle cropRectangle = GuiRectangle.GetGuiRectangle(this.Left, this.Top, this.Width, this.Height); + Rectangle selectionRect = new Rectangle(cropRectangle.Left - 1, cropRectangle.Top - 1, cropRectangle.Width + 1, cropRectangle.Height + 1); DrawSelectionBorder(g, selectionRect); // top - g.FillRectangle(cropBrush, new Rectangle(0, 0, parent.Width, r.Top)); + g.FillRectangle(cropBrush, new Rectangle(0, 0, parent.Width, cropRectangle.Top)); // left - g.FillRectangle(cropBrush, new Rectangle(0, r.Top, r.Left, r.Height)); + g.FillRectangle(cropBrush, new Rectangle(0, cropRectangle.Top, cropRectangle.Left, cropRectangle.Height)); // right - g.FillRectangle(cropBrush, new Rectangle(r.Left + r.Width, r.Top, parent.Width - (r.Left + r.Width), r.Height)); + g.FillRectangle(cropBrush, new Rectangle(cropRectangle.Left + cropRectangle.Width, cropRectangle.Top, parent.Width - (cropRectangle.Left + cropRectangle.Width), cropRectangle.Height)); // bottom - g.FillRectangle(cropBrush, new Rectangle(0, r.Top + r.Height, parent.Width, parent.Height - (r.Top + r.Height))); + g.FillRectangle(cropBrush, new Rectangle(0, cropRectangle.Top + cropRectangle.Height, parent.Width, parent.Height - (cropRectangle.Top + cropRectangle.Height))); } }