BUG-1711: Fix for a stacktrace, as something was accessed before it was drawn.

This commit is contained in:
RKrom 2014-12-01 17:21:01 +01:00
parent 089eec769e
commit bba978c209
2 changed files with 11 additions and 6 deletions

View file

@ -290,7 +290,9 @@ namespace Greenshot.Drawing {
}
public virtual void Invalidate() {
_parent.Invalidate(DrawingBounds);
if (Status != EditStatus.UNDRAWN) {
_parent.Invalidate(DrawingBounds);
}
}
public void AlignToParent(HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment) {

View file

@ -133,13 +133,16 @@ namespace Greenshot.Drawing {
/// </summary>
public override Rectangle DrawingBounds {
get {
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS);
Color lineColor = GetFieldValueAsColor(FieldType.LINE_COLOR);
using (Pen pen = new Pen(lineColor, lineThickness)) {
using (GraphicsPath tailPath = CreateTail()) {
return Rectangle.Inflate(Rectangle.Union(Rectangle.Round(tailPath.GetBounds(new Matrix(), pen)),GuiRectangle.GetGuiRectangle(Left, Top, Width, Height)), lineThickness+2, lineThickness+2);
if (Status != EditStatus.UNDRAWN) {
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS);
Color lineColor = GetFieldValueAsColor(FieldType.LINE_COLOR);
using (Pen pen = new Pen(lineColor, lineThickness)) {
using (GraphicsPath tailPath = CreateTail()) {
return Rectangle.Inflate(Rectangle.Union(Rectangle.Round(tailPath.GetBounds(new Matrix(), pen)), GuiRectangle.GetGuiRectangle(Left, Top, Width, Height)), lineThickness + 2, lineThickness + 2);
}
}
}
return Rectangle.Empty;
}
}