Пример #1
0
        internal HotRegion[] CheckHotRegions(int x, int y, Type[] objectTypes)
        {
            ArrayList arrayList = new ArrayList();

            for (int num = list.Count - 1; num >= 0; num--)
            {
                HotRegion hotRegion = (HotRegion)list[num];
                if (IsOfType(objectTypes, hotRegion.SelectedObject))
                {
                    GraphicsPath[] paths = ((HotRegion)list[num]).Paths;
                    foreach (GraphicsPath graphicsPath in paths)
                    {
                        if (graphicsPath != null && graphicsPath.IsVisible((float)x, (float)y))
                        {
                            arrayList.Add(list[num]);
                        }
                    }
                }
            }
            if (arrayList.Count > 0)
            {
                return((HotRegion[])arrayList.ToArray(typeof(HotRegion)));
            }
            return(null);
        }
Пример #2
0
 internal HitTestResult(HotRegion region, PointF hitTestPoint)
 {
     this.region = region;
     if (region != null)
     {
         obj = region.SelectedObject;
     }
     htPoint = hitTestPoint;
 }
Пример #3
0
        public void SetHotRegion(object selectedObject, PointF pinPoint, params GraphicsPath[] paths)
        {
            int       num = LocateObject(selectedObject);
            HotRegion hotRegion;

            if (num == -1)
            {
                hotRegion = new HotRegion();
                num       = list.Add(hotRegion);
            }
            else
            {
                hotRegion = (HotRegion)list[num];
            }
            hotRegion.SelectedObject = selectedObject;
            Matrix transform = Common.Graph.Transform;

            if (transform != null)
            {
                for (int i = 0; i < paths.Length; i++)
                {
                    if (paths[i] != null)
                    {
                        try
                        {
                            paths[i].Transform(transform);
                        }
                        catch
                        {
                            return;
                        }
                    }
                }
            }
            else
            {
                Common.Graph.Transform = new Matrix();
            }
            hotRegion.Paths = paths;
            if (!pinPoint.IsEmpty)
            {
                pinPoint.X += transform.OffsetX;
                pinPoint.Y += transform.OffsetY;
            }
            hotRegion.PinPoint = pinPoint;
            hotRegion.BuildMatrices(Common.Graph);
        }