WPF中获取形状范围

2021-03-23 00:25

阅读:512

标签:with   types   provider   end   lis   stat   red   bsp   int   

原文:WPF中获取形状范围

在没加入到Canvas时,也能获取形状的方法:

 

var polygon = new Polygon();
                polygon.Points.Add(new Point(xStart, yStart));
                polygon.Points.Add(new Point(xEnd, yStart));
                polygon.Points.Add(new Point(xEnd, yEnd));
                polygon.Points.Add(new Point(xStart, yEnd));
                polygon.Arrange(new Rect());
                var geom = polygon.RenderedGeometry;


                if (isFullContained)
                {
                    foreach (var cabinet in CurrentDataProvider.CabinetElementList)
                    {
                        if (geom.FillContainsWithDetail(cabinet.CabinetGeometry) == IntersectionDetail.FullyContains)
                        {
                            cabinet.CabinetStatus = CabinetElement.CabinetStatusTypes.Active;
                            isActiveCabinet = true;
                        }
                    }

                    
                }

 

WPF中获取形状范围

标签:with   types   provider   end   lis   stat   red   bsp   int   

原文地址:https://www.cnblogs.com/lonelyxmas/p/9473621.html


评论


亲,登录后才可以留言!