Fixed issue that when the CropContainer drawn and the surface is bigger than the window some part on the bottom is not drawn correctly.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1756 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-04-05 11:38:41 +00:00
commit 5b94650e81

View file

@ -39,21 +39,31 @@ namespace Greenshot.Drawing {
parent.Invalidate(); parent.Invalidate();
} }
/// <summary>
/// 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)
/// </summary>
public override Rectangle DrawingBounds {
get {
return new Rectangle(0,0,parent.Width, parent.Height);
}
}
public override void Draw(Graphics g, RenderMode rm) { public override void Draw(Graphics g, RenderMode rm) {
using (Brush cropBrush = new SolidBrush(Color.FromArgb(100, 150, 150, 100))) { using (Brush cropBrush = new SolidBrush(Color.FromArgb(100, 150, 150, 100))) {
Rectangle r = GuiRectangle.GetGuiRectangle(this.Left, this.Top, this.Width, this.Height); Rectangle cropRectangle = 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 selectionRect = new Rectangle(cropRectangle.Left - 1, cropRectangle.Top - 1, cropRectangle.Width + 1, cropRectangle.Height + 1);
DrawSelectionBorder(g, selectionRect); DrawSelectionBorder(g, selectionRect);
// top // top
g.FillRectangle(cropBrush, new Rectangle(0, 0, parent.Width, r.Top)); g.FillRectangle(cropBrush, new Rectangle(0, 0, parent.Width, cropRectangle.Top));
// left // 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 // 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 // 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)));
} }
} }