Recreated the changes from Jens

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2335 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-11-29 15:37:46 +00:00
commit 3a9abafdc8

View file

@ -536,23 +536,33 @@ namespace Greenshot.Forms {
} }
int pixelThickness = destinationRectangle.Width / sourceRectangle.Width; int pixelThickness = destinationRectangle.Width / sourceRectangle.Width;
using (Pen pen = new Pen(Color.Black, pixelThickness)) { using (Pen pen = new Pen(Color.White, 1)) {
int halfWidth = destinationRectangle.Width / 2; using (Brush brush = new SolidBrush(Color.Black)) {
int halfWidthEnd = (destinationRectangle.Width / 2) - (pixelThickness / 2); int halfWidth = destinationRectangle.Width / 2;
int halfHeight = destinationRectangle.Height / 2; int halfWidthEnd = (destinationRectangle.Width / 2) - (pixelThickness / 2);
int halfHeightEnd = (destinationRectangle.Height / 2) - (pixelThickness / 2); int halfHeight = destinationRectangle.Height / 2;
int halfHeightEnd = (destinationRectangle.Height / 2) - (pixelThickness / 2);
int drawAtHeight = destinationRectangle.Y + halfHeight; int drawAtHeight = destinationRectangle.Y + halfHeight - (pixelThickness / 2);
int drawAtWidth = destinationRectangle.X + halfWidth; int drawAtWidth = destinationRectangle.X + halfWidth - (pixelThickness / 2);
int padding = pixelThickness;
// Vertical top to middle // Vertical top to middle
graphics.DrawLine(pen, drawAtWidth, destinationRectangle.Y, drawAtWidth, destinationRectangle.Y + halfHeightEnd); graphics.FillRectangle(brush, drawAtWidth, destinationRectangle.Y + padding, pixelThickness, halfHeightEnd - 2 * padding);
// Vertical middle + 1 to bottom graphics.DrawRectangle(pen, drawAtWidth, destinationRectangle.Y + padding, pixelThickness, halfHeightEnd - 2 * padding);
graphics.DrawLine(pen, drawAtWidth, destinationRectangle.Y + halfHeightEnd + pixelThickness, drawAtWidth, destinationRectangle.Y + destinationRectangle.Height); // Vertical middle + 1 to bottom
// Horizontal left to middle graphics.FillRectangle(brush, drawAtWidth, destinationRectangle.Y + halfHeightEnd + pixelThickness + padding, pixelThickness, halfHeightEnd - 2 * padding);
graphics.DrawLine(pen, destinationRectangle.X, drawAtHeight, destinationRectangle.X + halfWidthEnd, drawAtHeight); graphics.DrawRectangle(pen, drawAtWidth, destinationRectangle.Y + halfHeightEnd + pixelThickness + padding, pixelThickness, halfHeightEnd - 2 * padding);
// Horizontal middle + 1 to right // Horizontal left to middle
graphics.DrawLine(pen, destinationRectangle.X + halfWidthEnd + pixelThickness, drawAtHeight, destinationRectangle.X + destinationRectangle.Width, drawAtHeight); graphics.FillRectangle(brush, destinationRectangle.X + padding, drawAtHeight, halfWidthEnd - 2 * padding, pixelThickness);
graphics.DrawRectangle(pen, destinationRectangle.X + padding, drawAtHeight, halfWidthEnd - 2 * padding, pixelThickness);
// Horizontal middle + 1 to right
graphics.FillRectangle(brush, destinationRectangle.X + halfWidthEnd + pixelThickness + padding, drawAtHeight, halfWidthEnd - 2 * padding, pixelThickness);
graphics.DrawRectangle(pen, destinationRectangle.X + halfWidthEnd + pixelThickness + padding, drawAtHeight, halfWidthEnd - 2 * padding, pixelThickness);
pen.Width = 2;
graphics.DrawEllipse(pen, destinationRectangle);
}
} }
} }