相关疑难解决方法(0)

如何知道GraphicsPath是否包含C#中的一个点

我正在使用.NET绘制图表,我想在用户点击它们时突出显示对象.当图形完全包含在矩形中时很容易:

if (figure.Bounds.Contains(p)) // bounds is a rectangle
Run Code Online (Sandbox Code Playgroud)

但如果数字很复杂,我不知道如何管理它GraphicsPath.

GraphicsPath为图(绿色圆圈)定义了以下内容.

的GraphicsPath

我想在用户点击它时突出显示该图.我想知道是否Point包含a GraphicsPath.

有任何想法吗?提前致谢.

.net c# drawing system.drawing

8
推荐指数
1
解决办法
6788
查看次数

如何在C#中拖动和移动形状

在C#WindoeFormsApplication中,是否可以选择,从而用鼠标移动或删除绘制的形状?就像Windows的画图程序一样。

形状绘图工作得很好,所有点都存储在某个数组中。作为此线图示例

Point Latest { get; set; }

List<Point> _points = new List<Point>(); 

protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);

// Save the mouse coordinates
Latest = new Point(e.X, e.Y);

// Force to invalidate the form client area and immediately redraw itself. 
Refresh();
}

protected override void OnPaint(PaintEventArgs e)
{
var g = e.Graphics;
base.OnPaint(e);

if (_points.Count > 0)
{
    var pen = new Pen(Color.Navy);
    var pt = _points[0];
    for(var i=1; _points.Count > i; i++)
    {
        var next = _points[i]; …
Run Code Online (Sandbox Code Playgroud)

c# user-interface drawing gdi+ winforms

4
推荐指数
1
解决办法
2745
查看次数

标签 统计

c# ×2

drawing ×2

.net ×1

gdi+ ×1

system.drawing ×1

user-interface ×1

winforms ×1