DrawToolsRedux/ToolPolyLine.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System.Drawing;
using System.Windows.Forms;
namespace DrawTools
{
/// <summary>
/// PolyLine tool (a PolyLine is a series of connected straight lines where each line is drawn individually)
/// </summary>
internal class ToolPolyLine : ToolObject
{
public ToolPolyLine()
{
Cursor = new Cursor(GetType(), "Pencil.cur");
}
private DrawPolyLine newPolyLine;
private bool _drawingInProcess = false; // Set to true when drawing
/// <summary>
/// Left nouse button is pressed
/// </summary>
/// <param name="drawArea"></param>
/// <param name="e"></param>
public override void OnMouseDown(DrawArea drawArea, MouseEventArgs e)
{
if (e.Button ==
MouseButtons.Right)
{
_drawingInProcess = false;
newPolyLine = null;
}
else
{
Point p = drawArea.BackTrackMouse(new Point(e.X, e.Y));
if (drawArea.PenType ==
DrawingPens.PenType.Generic)
{
if (_drawingInProcess == false)
{
newPolyLine = new DrawPolyLine(p.X, p.Y, p.X + 1, p.Y + 1, drawArea.LineColor, drawArea.LineWidth);
newPolyLine.EndPoint = new Point(p.X + 1, p.Y + 1);
AddNewObject(drawArea, newPolyLine);
_drawingInProcess = true;
}
else
{
// Drawing is in process, so simply add a new point
newPolyLine.AddPoint(p);
newPolyLine.EndPoint = p;
}
}
else
{
if (_drawingInProcess == false)
{
newPolyLine = new DrawPolyLine(p.X, p.Y, p.X + 1, p.Y + 1, drawArea.PenType);
newPolyLine.EndPoint = new Point(p.X + 1, p.Y + 1);
AddNewObject(drawArea, newPolyLine);
_drawingInProcess = true;
}
后面还有 33 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。