Exemplo n.º 1
0
 public RectangleRegion(Image backgroundImage = null)
     : base(backgroundImage)
 {
     AreaManager = new AreaManager(this);
     KeyDown += RectangleRegion_KeyDown;
     MouseDown += RectangleRegion_MouseDown;
     MouseWheel += RectangleRegion_MouseWheel;
 }
Exemplo n.º 2
0
 public RectangleRegion(Image backgroundImage = null)
     : base(backgroundImage)
 {
     AreaManager = new AreaManager(this);
     KeyDown    += RectangleRegion_KeyDown;
     MouseDown  += RectangleRegion_MouseDown;
     MouseWheel += RectangleRegion_MouseWheel;
 }
Exemplo n.º 3
0
        public ResizeManager(Surface surface, AreaManager areaManager)
        {
            this.surface     = surface;
            this.areaManager = areaManager;

            MinMoveSpeed = surface.Config.MinMoveSpeed;
            MaxMoveSpeed = surface.Config.MaxMoveSpeed;

            surface.KeyDown += new KeyEventHandler(surface_KeyDown);

            nodes = new NodeObject[8];

            for (int i = 0; i < 8; i++)
            {
                nodes[i] = surface.MakeNode();
            }

            nodes[(int)NodePosition.BottomRight].Order = 10;
        }
Exemplo n.º 4
0
        public ResizeManager(Surface surface, AreaManager areaManager)
        {
            this.surface = surface;
            this.areaManager = areaManager;

            MinMoveSpeed = surface.Config.MinMoveSpeed;
            MaxMoveSpeed = surface.Config.MaxMoveSpeed;

            surface.KeyDown += surface_KeyDown;

            nodes = new NodeObject[8];

            for (int i = 0; i < 8; i++)
            {
                nodes[i] = surface.MakeNode();
            }

            nodes[(int)NodePosition.BottomRight].Order = 10;
        }
 public RectangleRegion(Image backgroundImage = null)
     : base(backgroundImage)
 {
     AreaManager = new AreaManager(this);
 }
Exemplo n.º 6
0
        protected override void Draw(Graphics g)
        {
            borderDotPen2.DashOffset = (float)timer.Elapsed.TotalSeconds * 10;

            List <Rectangle> areas = AreaManager.GetValidAreas;

            if (areas.Count > 0 || !AreaManager.CurrentHoverArea.IsEmpty)
            {
                UpdateRegionPath();

                if (areas.Count > 0)
                {
                    using (Region region = new Region(regionDrawPath))
                    {
                        g.Clip = region;
                        g.FillRectangle(lightBackgroundBrush, ScreenRectangle0Based);
                        g.ResetClip();
                    }

                    g.DrawPath(borderPen, regionDrawPath);

                    if (areas.Count > 1)
                    {
                        Rectangle totalArea = AreaManager.CombineAreas();
                        g.DrawCrossRectangle(borderPen, totalArea, 15);

                        if (Config.ShowInfo)
                        {
                            ImageHelpers.DrawTextWithOutline(g, string.Format("X:{0} Y:{1} W:{2} H:{3}", totalArea.X, totalArea.Y,
                                                                              totalArea.Width, totalArea.Height), new PointF(totalArea.X + 5, totalArea.Y - 25), textFont, Color.White, Color.Black);
                        }
                    }
                }

                if (AreaManager.IsCurrentHoverAreaValid)
                {
                    using (GraphicsPath hoverDrawPath = new GraphicsPath {
                        FillMode = FillMode.Winding
                    })
                    {
                        AddShapePath(hoverDrawPath, AreaManager.CurrentHoverArea.SizeOffset(-1));

                        g.DrawPath(borderDotPen, hoverDrawPath);
                        g.DrawPath(borderDotPen2, hoverDrawPath);
                    }
                }

                if (AreaManager.IsCurrentAreaValid)
                {
                    g.DrawRectangleProper(borderDotPen, AreaManager.CurrentArea);
                    g.DrawRectangleProper(borderDotPen2, AreaManager.CurrentArea);
                    DrawObjects(g);
                }

                if (Config.ShowInfo)
                {
                    foreach (Rectangle area in areas)
                    {
                        if (area.IsValid())
                        {
                            ImageHelpers.DrawTextWithOutline(g, string.Format("X:{0} Y:{1}\nW:{2} H:{3}", area.X, area.Y, area.Width, area.Height),
                                                             new PointF(area.X + 5, area.Y + 5), textFont, Color.White, Color.Black);
                        }
                    }
                }
            }

            if (Config.ShowMagnifier)
            {
                DrawMagnifier(g);
            }

            if (Config.ShowCrosshair)
            {
                DrawCrosshair(g);
            }
        }
Exemplo n.º 7
0
 protected override void Update()
 {
     base.Update();
     AreaManager.Update();
 }
 public RectangleRegion(Image backgroundImage = null)
     : base(backgroundImage)
 {
     AreaManager = new AreaManager(this);
 }