Draw cross center of crop tool area

This commit is contained in:
Jaex 2017-12-25 13:37:25 +03:00
parent cabab93b05
commit b4d512374b
3 changed files with 15 additions and 4 deletions

View file

@ -111,6 +111,18 @@ public static void DrawDiamond(this Graphics g, Pen pen, Rectangle rect)
}
}
public static void DrawCross(this Graphics g, Pen pen, Point center, int crossSize)
{
if (crossSize > 0)
{
// Horizontal
g.DrawLine(pen, center.X - crossSize, center.Y, center.X + crossSize, center.Y);
// Vertical
g.DrawLine(pen, center.X, center.Y - crossSize, center.X, center.Y + crossSize);
}
}
public static void DrawCrossRectangle(this Graphics g, Pen pen, Rectangle rect, int crossSize)
{
rect = rect.SizeOffset(-1);

View file

@ -786,10 +786,7 @@ private void Draw(Graphics g)
DrawRuler(g, ShapeManager.CurrentRectangle, borderPen, 5, 10);
DrawRuler(g, ShapeManager.CurrentRectangle, borderPen, 15, 100);
Point centerPos = new Point(ShapeManager.CurrentRectangle.X + ShapeManager.CurrentRectangle.Width / 2, ShapeManager.CurrentRectangle.Y + ShapeManager.CurrentRectangle.Height / 2);
int markSize = 10;
g.DrawLine(borderPen, centerPos.X, centerPos.Y - markSize, centerPos.X, centerPos.Y + markSize);
g.DrawLine(borderPen, centerPos.X - markSize, centerPos.Y, centerPos.X + markSize, centerPos.Y);
g.DrawCross(borderPen, ShapeManager.CurrentRectangle.Center(), 10);
}
DrawRegionArea(g, ShapeManager.CurrentRectangle, true);

View file

@ -23,6 +23,7 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3)
using ShareX.HelpersLib;
using System;
using System.Collections.Generic;
using System.Drawing;
@ -40,6 +41,7 @@ public virtual void OnDraw(Graphics g)
if (IsValidShape)
{
Manager.DrawRegionArea(g, Rectangle, true);
g.DrawCross(Pens.Black, Rectangle.Center(), 10);
}
}
}