zoukankan      html  css  js  c++  java
  • GDI画图,判断鼠标点击点在某一画好的多边形、矩形、图形里

    Region.IsVisible方法

    简单方便准确

    private bool CheckPntInPoly(Point[] points, Point pnt)
    
            {
    
                if (points == null || points.Length == 0 || pnt == Point.Empty)
    
                {
    
                    return false;
    
                }
    
     
    
                System.Drawing.Drawing2D.GraphicsPath myGraphicsPath=newSystem.Drawing.Drawing2D.GraphicsPath();               
    
                Region myRegion=new Region();                       
    
                myGraphicsPath.Reset();  
    
     
    
                myGraphicsPath.AddPolygon(points); 
    
                myRegion.MakeEmpty();  
    
                myRegion.Union(myGraphicsPath);  
    
                //返回判断点是否在多边形里
    
                return myRegion.IsVisible(pnt);         
    
            }

     

  • 相关阅读:
    autocare使用命令
    使用国内豆瓣源
    HCNA(二)以太网的帧结构
    HCNA(一)网络传输介质
    Python
    Python
    Python
    Delphi
    HCNP
    Python
  • 原文地址:https://www.cnblogs.com/jhlong/p/5433818.html
Copyright © 2011-2022 走看看