mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Draw cross center of crop tool area
This commit is contained in:
parent
cabab93b05
commit
b4d512374b
3 changed files with 15 additions and 4 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue