public override void onMouseOver(Vector2 mouseworldpos)
        {
            //System.Diagnostics.Debug.WriteLine(System.DateTime.Now.ToString() + "RectangleItem.onMouseOver()");

            int edgewidth = 10;

            if (Math.Abs(mouseworldpos.X - Rectangle.Left) <= edgewidth)
            {
                MainForm.Instance.pictureBox1.Cursor = Cursors.SizeWE;
                edgeundermouse = EdgeEnum.left;
            }
            else if (Math.Abs(mouseworldpos.X - Rectangle.Right) <= edgewidth)
            {
                MainForm.Instance.pictureBox1.Cursor = Cursors.SizeWE;
                edgeundermouse = EdgeEnum.right;
            }
            else if (Math.Abs(mouseworldpos.Y - Rectangle.Top) <= edgewidth)
            {
                MainForm.Instance.pictureBox1.Cursor = Cursors.SizeNS;
                edgeundermouse = EdgeEnum.top;
            }
            else if (Math.Abs(mouseworldpos.Y - Rectangle.Bottom) <= edgewidth)
            {
                MainForm.Instance.pictureBox1.Cursor = Cursors.SizeNS;
                edgeundermouse = EdgeEnum.bottom;
            }
            else
            {
                MainForm.Instance.pictureBox1.Cursor = Cursors.Default;
                edgeundermouse = EdgeEnum.none;
            }
            base.onMouseOver(mouseworldpos);
        }
Example #2
0
        /// <summary>
        /// Builds a unique key for a grid cell style. For each of those keys, a separate C1PrintDocument
        /// style is built that is used as Parent for the corresponding RenderTable cell's style.
        /// </summary>
        /// <param name="cs">The grid cell style.</param>
        /// <param name="dataType">The grid cell data type (used to disambiguate "general" text alignment).</param>
        /// <param name="value">The grid cell text (used to disambiguate "general" text alignment).</param>
        /// <param name="edges">Outer edges of the table on which the cell borders.</param>
        /// <param name="borderLeft">The left border of the cell (which is the right border of the cell on the left).</param>
        /// <param name="borderTop">The top border of the cell (which is the bottom border of the cell on the top).</param>
        /// <returns>A unique key identifying the cell style.</returns>
        private string BuildCellStyleKey(CellStyle cs, Type dataType, string value, EdgeEnum edges, LineDef borderLeft, LineDef borderTop)
        {
            // note: using CellStyle.BuildString is VERY slow if background images are included, hence this.
            string str = string.Format(CultureInfo.InvariantCulture,
                                       "{0:X}{1:X}{2:X}{3:X}{4:X}{5:X}{6:X}{7:X}{8:X}{9:X}{10:X}",
                                       cs.Display.GetHashCode(),
                                       cs.Font.GetHashCode(),
                                       cs.BackColor.GetHashCode(),
                                       cs.ForeColor.GetHashCode(),
                                       cs.TextAlign.GetHashCode(),
                                       cs.TextDirection.GetHashCode(),
                                       cs.ImageAlign.GetHashCode(),
                                       cs.WordWrap.GetHashCode(),
                                       cs.Border.GetHashCode(), // ??
                                       cs.BackgroundImage != null && cs.BackgroundImageLayout != ImageAlignEnum.Hide ? cs.BackgroundImage.GetHashCode() : 0,
                                       cs.BackgroundImageLayout.GetHashCode());

            // Style attributes NOT included:
            // StyleElementFlags.Format
            // StyleElementFlags.EditMask
            // StyleElementFlags.ComboList
            // StyleElementFlags.DataType
            // StyleElementFlags.Margins
            // StyleElementFlags.TextEffect
            // StyleElementFlags.ImageSpacing
            // StyleElementFlags.Trimming

            return(str);
        }
Example #3
0
        private void BlobPanel_MouseDown(object sender, MouseEventArgs e)
        {
            // We care only for right-click.
            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            // Check on what edge we are clicked.
            EdgeEnum edge = IsOnEdge(e.Location);

            // If we are not on any edge it means we should select this blob.
            if (edge == EdgeEnum.None)
            {
                // Flip the selection flag on the Panel and raise event.
                Selected = !Selected;
                OnSelectedChanged(EventArgs.Empty);
                Invalidate();

                return;
            }

            // We are on some edge, activate the resizing.
            m_resize = true;
        }
Example #4
0
        /// <summary>
        /// Calculates which outer table edges the specified cell range borders on.
        /// </summary>
        /// <param name="cr">The cell range to test.</param>
        /// <param name="gridRowFirst">The index of the first printed grid row.</param>
        /// <param name="gridColFirst">The index of the first printed grid column.</param>
        /// <param name="gridRowLast">The index of the last printed grid row.</param>
        /// <param name="gridColLast">The index of the last printed grid column.</param>
        /// <returns>A combination of EdgeEnum flags indicating which edges the range borders on.</returns>
        private EdgeEnum CalcEdges(CellRange cr, int gridRowFirst, int gridColFirst, int gridRowLast, int gridColLast)
        {
            EdgeEnum ret = EdgeEnum.None;

            // avoid extra work if we're not printing borders anyway:
            if (!PrintInfo.PrintBorders)
            {
                return(ret);
            }
            if (cr.r1 == gridRowFirst)
            {
                ret |= EdgeEnum.Top;
            }
            if (cr.r2 == gridRowLast)
            {
                ret |= EdgeEnum.Bottom;
            }
            if (cr.c1 == gridColFirst)
            {
                ret |= EdgeEnum.Left;
            }
            if (cr.c2 == gridColLast)
            {
                ret |= EdgeEnum.Right;
            }
            return(ret);
        }
Example #5
0
    private void mControl_MouseLeave(object sender, System.EventArgs e)
    {
        Control c = (Control)sender;

        mEdge = EdgeEnum.None;
        c.Refresh();
    }
Example #6
0
        public void mControl_MouseLeave(object sender, System.EventArgs e)
        {
            Control c = ((Control)sender);

            mEdge = EdgeEnum.None;
            c.Refresh();
            c.Cursor = Cursors.Default;
        }
Example #7
0
        /// <summary>
        /// Gets the C1PrintDocument style corresponding to the specified C1FlexGrid cell style.
        /// If the required style has not been created yet, it is created and added to the _styles
        /// hashtable for reuse.
        /// </summary>
        /// <param name="cellStyle">The grid cell style.</param>
        /// <param name="styles">The C1PrintDocument styles collection to which a new style may be added.</param>
        /// <param name="dataType">The grid cell data type (used to disambiguate general text alignment).</param>
        /// <param name="value">The grid cell text (used to disambiguate general text alignment).</param>
        /// <param name="edges">Outer edges of the table on which the cell borders.</param>
        /// <param name="borderLeft">The left border of the cell (which is the right border of the cell on the left).</param>
        /// <param name="borderTop">The top border of the cell (which is the bottom border of the cell on the top).</param>
        /// <returns>The style to apply to the RenderTable cell.</returns>
        private Style StyleFromGridStyle(CellStyle cellStyle, StyleCollection styles, Type dataType, string value,
                                         EdgeEnum edges, LineDef borderLeft, LineDef borderTop)
        {
            string key = BuildCellStyleKey(cellStyle, dataType, value, edges, borderLeft, borderTop);

            // if a matching style already exists just use it:
            if (_styles.ContainsKey(key))
            {
                return(_styles[key]);
            }

            Style s = styles.Add();

            // we do not want to inherit any non-ambient properties from the "styles" owner -
            // all that is needed will be explicitly set by CopyCellStyle:
            s.Parent = null;
            // build the style based on cell style and other data:
            CopyCellStyle(s, cellStyle, dataType, value, edges, borderLeft, borderTop);
            // add the style to the hashtable for reuse, and return:
            _styles[key] = s;
            return(s);
        }
Example #8
0
        public override bool onMouseOver(Vector2 mouseworldpos, out string msg)
        {
            //System.Diagnostics.Debug.WriteLine(System.DateTime.Now.ToString() + "RectangleItem.onMouseOver()");
            msg = String.Empty;
            var edgewidth = 10;

            if (Math.Abs(mouseworldpos.X - boundingrectangle.Left) <= edgewidth)
            {
                //MainForm.Instance.picturebox.Cursor = Cursors.SizeWE;
                edgeundermouse = EdgeEnum.left;
                return(true);
            }
            else if (Math.Abs(mouseworldpos.X - boundingrectangle.Right) <= edgewidth)
            {
                //MainForm.Instance.picturebox.Cursor = Cursors.SizeWE;
                edgeundermouse = EdgeEnum.right;
                return(true);
            }
            else if (Math.Abs(mouseworldpos.Y - boundingrectangle.Top) <= edgewidth)
            {
                //MainForm.Instance.picturebox.Cursor = Cursors.SizeNS;
                edgeundermouse = EdgeEnum.top;
                return(true);
            }
            else if (Math.Abs(mouseworldpos.Y - boundingrectangle.Bottom) <= edgewidth)
            {
                //MainForm.Instance.picturebox.Cursor = Cursors.SizeNS;
                edgeundermouse = EdgeEnum.bottom;
                return(true);
            }
            else
            {
                //MainForm.Instance.picturebox.Cursor = Cursors.Default;
                edgeundermouse = EdgeEnum.none;
                return(false);
            }
            //return false;
            //base.onMouseOver(mouseworldpos);
        }
Example #9
0
            public bool CanConnectToOtherTile(Tile other, EdgeEnum onEdge)
            {
                var thisEdges  = GetEdges();
                var otherEdges = other.GetEdges();

                if (onEdge == EdgeEnum.Left && thisEdges[EdgeEnum.Left].SequenceEqual(otherEdges[EdgeEnum.Right]))
                {
                    return(true);
                }
                if (onEdge == EdgeEnum.Right && thisEdges[EdgeEnum.Right].SequenceEqual(otherEdges[EdgeEnum.Left]))
                {
                    return(true);
                }
                if (onEdge == EdgeEnum.Top && thisEdges[EdgeEnum.Top].SequenceEqual(otherEdges[EdgeEnum.Bottom]))
                {
                    return(true);
                }
                if (onEdge == EdgeEnum.Bottom && thisEdges[EdgeEnum.Bottom].SequenceEqual(otherEdges[EdgeEnum.Top]))
                {
                    return(true);
                }

                return(false);
            }
Example #10
0
        /// <summary>
        /// Adjusts the passed style to mach the appearance of the specified C1FlexGrid cell style.
        /// Also takes into account cell data (affects "general" text alignment), and whether the
        /// cell is at the edge of the containing table (affects borders).
        /// </summary>
        /// <param name="target">The target style to modify.</param>
        /// <param name="source">The source cell style.</param>
        /// <param name="dataType">The grid cell data type (used to disambiguate general text alignment).</param>
        /// <param name="value">The grid cell text (used to disambiguate general text alignment).</param>
        /// <param name="edges">Outer edges of the table on which the cell borders.</param>
        /// <param name="borderLeft">The left border of the cell (which is the right border of the cell on the left).</param>
        /// <param name="borderTop">The top border of the cell (which is the bottom border of the cell on the top).</param>
        private void CopyCellStyle(Style target, CellStyle source, Type dataType, string value, EdgeEnum edges, LineDef borderLeft, LineDef borderTop)
        {
            target.Font      = source.Font;
            target.BackColor = source.BackColor;
            target.TextColor = source.ForeColor;

            if (source.TextDirection == TextDirectionEnum.Up)
            {
                target.TextAngle = 90;
            }
            else if (source.TextDirection == TextDirectionEnum.Down)
            {
                target.TextAngle = 270;
            }

            // source.Trimming

            target.WordWrap = source.WordWrap;
            TextAlignInfo ta = s_TextAlignToTA[GetTextAlign(source, dataType, value)];

            target.TextAlignHorz = ta.Horz;
            target.TextAlignVert = ta.Vert;

            ImageAlignInfo ia = s_ImageAlignToIA[source.ImageAlign];

            target.ImageAlign.AlignHorz = ia.Horz;
            target.ImageAlign.AlignVert = ia.Vert;
            if (source.ImageAlign == ImageAlignEnum.Scale)
            {
                target.ImageAlign.BestFit         = true;
                target.ImageAlign.StretchVert     = true;
                target.ImageAlign.StretchHorz     = true;
                target.ImageAlign.KeepAspectRatio = true;
            }
            else if (source.ImageAlign == ImageAlignEnum.Stretch)
            {
                target.ImageAlign.StretchVert     = true;
                target.ImageAlign.StretchHorz     = true;
                target.ImageAlign.KeepAspectRatio = false;
            }
            else
            {
                target.ImageAlign.StretchVert     = false;
                target.ImageAlign.StretchHorz     = false;
                target.ImageAlign.KeepAspectRatio = true;
            }
            // todo: handle Tile/TileStretch

            // borders:
            if (PrintInfo.PrintBorders)
            {
                // note: outer borders are defined by EmptyArea style.
                // left:
                if ((edges & EdgeEnum.Left) != 0)
                {
                    target.Borders.Left = BorderToLineDef(_grid.Styles.EmptyArea, false);
                }
                else
                {
                    target.Borders.Left = borderLeft;
                }
                // top:
                if ((edges & EdgeEnum.Top) != 0)
                {
                    target.Borders.Top = BorderToLineDef(_grid.Styles.EmptyArea, true);
                }
                else
                {
                    target.Borders.Top = borderTop;
                }
                // right:
                if ((edges & EdgeEnum.Right) != 0)
                {
                    target.Borders.Right = BorderToLineDef(_grid.Styles.EmptyArea, false);
                }
                else
                {
                    target.Borders.Right = BorderToLineDef(source, false);
                }
                // bottom:
                if ((edges & EdgeEnum.Bottom) != 0)
                {
                    target.Borders.Bottom = BorderToLineDef(_grid.Styles.EmptyArea, true);
                }
                else
                {
                    target.Borders.Bottom = BorderToLineDef(source, true);
                }
            }

            CopyBackgroundImage(target, source);

            // style attributes that are ignored (todo):
            // source.TextEffect

            // style attributes that are accounted for elsewhere and/or irrelevant for print:
            // source.Padding
            // source.Display
            // source.Format
            // source.DataType
            // source.ImageAlign
            // source.ImageSpacing
            // source.EditMask
            // source.ComboList
        }
Example #11
0
    private void mControl_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
    {
        Control  c = (Control)sender;
        Graphics g = c.CreateGraphics();

        switch (mEdge)
        {
        case EdgeEnum.TopLeft:
            g.FillRectangle(Brushes.Fuchsia, 0, 0, mWidth * 4, mWidth * 4);
            mOutlineDrawn = true;
            break;

        case EdgeEnum.Left:
            g.FillRectangle(Brushes.Fuchsia, 0, 0, mWidth, c.Height);
            mOutlineDrawn = true;
            break;

        case EdgeEnum.Right:
            g.FillRectangle(Brushes.Fuchsia, c.Width - mWidth, 0, c.Width, c.Height);
            mOutlineDrawn = true;
            break;

        case EdgeEnum.Top:
            g.FillRectangle(Brushes.Fuchsia, 0, 0, c.Width, mWidth);
            mOutlineDrawn = true;
            break;

        case EdgeEnum.Bottom:
            g.FillRectangle(Brushes.Fuchsia, 0, c.Height - mWidth, c.Width, mWidth);
            mOutlineDrawn = true;
            break;

        case EdgeEnum.None:
            if (mOutlineDrawn)
            {
                c.Refresh();
                mOutlineDrawn = false;
            }
            break;
        }

        if (mMouseDown & mEdge != EdgeEnum.None)
        {
            c.SuspendLayout();
            switch (mEdge)
            {
            case EdgeEnum.TopLeft:
                c.SetBounds(c.Left + e.X, c.Top + e.Y, c.Width, c.Height);
                break;

            case EdgeEnum.Left:
                c.SetBounds(c.Left + e.X, c.Top, c.Width - e.X, c.Height);
                break;

            case EdgeEnum.Right:
                c.SetBounds(c.Left, c.Top, c.Width - (c.Width - e.X), c.Height);
                break;

            case EdgeEnum.Top:
                c.SetBounds(c.Left, c.Top + e.Y, c.Width, c.Height - e.Y);
                break;

            case EdgeEnum.Bottom:
                c.SetBounds(c.Left, c.Top, c.Width, c.Height - (c.Height - e.Y));
                break;
            }
            c.ResumeLayout();
        }
        else
        {
            if (e.X <= (mWidth * 4) & e.Y <= (mWidth * 4))
            {
                //top left corner
                c.Cursor = Cursors.SizeAll;
                mEdge    = EdgeEnum.TopLeft;
            }
            else if (e.X <= mWidth)
            {
                //left edge
                c.Cursor = Cursors.VSplit;
                mEdge    = EdgeEnum.Left;
            }
            else if (e.X > c.Width - (mWidth + 1))
            {
                //right edge
                c.Cursor = Cursors.VSplit;
                mEdge    = EdgeEnum.Right;
            }
            else if (e.Y <= mWidth)
            {
                //top edge
                c.Cursor = Cursors.HSplit;
                mEdge    = EdgeEnum.Top;
            }
            else if (e.Y > c.Height - (mWidth + 1))
            {
                //bottom edge
                c.Cursor = Cursors.HSplit;
                mEdge    = EdgeEnum.Bottom;
            }
            else
            {
                //no edge
                c.Cursor = Cursors.Default;
                mEdge    = EdgeEnum.None;
            }
        }
    }
        public override void onMouseOver(Vector2 mouseworldpos)
        {
            //System.Diagnostics.Debug.WriteLine(System.DateTime.Now.ToString() + "RectangleItem.onMouseOver()");

            int edgewidth = 10;
            if (Math.Abs(mouseworldpos.X - Rectangle.Left) <= edgewidth)
            {
                MainForm.Instance.pictureBox1.Cursor = Cursors.SizeWE;
                edgeundermouse = EdgeEnum.left;
            }
            else if (Math.Abs(mouseworldpos.X - Rectangle.Right) <= edgewidth)
            {
                MainForm.Instance.pictureBox1.Cursor = Cursors.SizeWE;
                edgeundermouse = EdgeEnum.right;
            }
            else if (Math.Abs(mouseworldpos.Y - Rectangle.Top) <= edgewidth)
            {
                MainForm.Instance.pictureBox1.Cursor = Cursors.SizeNS;
                edgeundermouse = EdgeEnum.top;
            }
            else if (Math.Abs(mouseworldpos.Y - Rectangle.Bottom) <= edgewidth)
            {
                MainForm.Instance.pictureBox1.Cursor = Cursors.SizeNS;
                edgeundermouse = EdgeEnum.bottom;
            }
            else
            {
                MainForm.Instance.pictureBox1.Cursor = Cursors.Default;
                edgeundermouse = EdgeEnum.none;
            }
            base.onMouseOver(mouseworldpos);
        }
Example #13
0
        private void BlobPanel_MouseMove(object sender, MouseEventArgs e)
        {
            // Get what edge we are on.
            EdgeEnum edge = IsOnEdge(e.Location);

            switch (edge)
            {
            case EdgeEnum.Left:
                // Set the resize cursor
                Cursor = Cursors.SizeWE;

                // If resizing update location and width.
                if (m_resize)
                {
                    // Since we are resizing the left border we need to move the entire panel, so first we move it.
                    Location = new Point(Location.X + e.X, Location.Y);

                    // Since we moved the panel we need now to extend (or shrink) it accordingly.
                    Width += -1 * e.X;
                    Invalidate();
                }
                break;

            case EdgeEnum.Right:
                // Set the resize cursor
                Cursor = Cursors.SizeWE;

                // If resizing update location and width.
                if (m_resize)
                {
                    // We move the right panel, so all we do is update the width accordingly (no need to move the panel).
                    Width = e.X;
                    Invalidate();
                }
                break;

            case EdgeEnum.Top:
                // Set the resize cursor
                Cursor = Cursors.SizeNS;

                // If resizing update location and width.
                if (m_resize)
                {
                    // Since we are resizing the top border we need to move the entire panel, so first we move it.
                    Location = new Point(Location.X, Location.Y + e.Y);

                    // Since we moved the panel we need now to extend (or shrink) it accordingly.
                    Height += -1 * e.Y;
                    Invalidate();
                }
                break;

            case EdgeEnum.Bottom:
                // Set the resize cursor
                Cursor = Cursors.SizeNS;

                // If resizing update location and width.
                if (m_resize)
                {
                    // We move the bottom panel, so all we do is update the height accordingly (no need to move the panel).
                    Height = e.Y;
                    Invalidate();
                }
                break;

            default:
                // Set the select cursor
                Cursor = Cursors.Hand;
                break;
            }
        }
Example #14
0
        public void mControl_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            Control  c = ((Control)sender);
            Graphics g = c.CreateGraphics();

            switch (mEdge)
            {
            case EdgeEnum.Moving:
                mOutlineDrawn = true;
                break;

            case EdgeEnum.BottomRight:
                DrawOrangeSquares(c, g);
                g.FillRectangle(Brushes.Black, c.Width - mWidth, c.Height - mWidth, mWidth, mWidth);
                mOutlineDrawn = true;
                break;

            case EdgeEnum.BottomLeft:
                DrawOrangeSquares(c, g);
                g.FillRectangle(Brushes.Fuchsia, 0, c.Height - mWidth, mWidth, mWidth);
                mOutlineDrawn = true;
                break;

            case EdgeEnum.TopRight:
                DrawOrangeSquares(c, g);
                g.FillRectangle(Brushes.Fuchsia, c.Width - mWidth, 0, mWidth, mWidth);     //top right
                mOutlineDrawn = true;
                break;

            case EdgeEnum.TopLeft:
                DrawOrangeSquares(c, g);
                g.FillRectangle(Brushes.Fuchsia, 0, 0, mWidth, mWidth);     //top left
                mOutlineDrawn = true;
                break;

            case EdgeEnum.Left:
                DrawOrangeSquares(c, g);
                g.FillRectangle(Brushes.Fuchsia, 0, c.Height / 2 - 4, mWidth, mWidth);     //left
                mOutlineDrawn = true;
                break;

            case EdgeEnum.Right:
                DrawOrangeSquares(c, g);
                g.FillRectangle(Brushes.Fuchsia, c.Width - mWidth, c.Height / 2 - 4, mWidth, mWidth);     //right
                mOutlineDrawn = true;
                break;

            case EdgeEnum.Top:
                DrawOrangeSquares(c, g);
                g.FillRectangle(Brushes.Fuchsia, c.Width / 2 - 4, 0, mWidth, mWidth);     //top
                mOutlineDrawn = true;
                break;

            case EdgeEnum.Bottom:
                DrawOrangeSquares(c, g);
                g.FillRectangle(Brushes.Fuchsia, c.Width / 2 - 4, c.Height - mWidth, mWidth, mWidth);     //bottom
                mOutlineDrawn = true;
                break;

            case EdgeEnum.None:
                if (mOutlineDrawn)
                {
                    c.Refresh();
                    mOutlineDrawn = false;
                }
                break;
            }

            if (mMouseDown & mEdge != EdgeEnum.None)
            {
                //MessageBox.Show(Convert.ToString(c));
                c.SuspendLayout();
                switch (mEdge)
                {
                case EdgeEnum.TopRight:
                    c.SetBounds(c.Left, c.Top, c.Width - (c.Width - e.X), c.Height);
                    c.SetBounds(c.Left, c.Top + e.Y, c.Width, c.Height - e.Y);
                    break;

                case EdgeEnum.TopLeft:
                    c.SetBounds(c.Left + e.X, c.Top, c.Width - e.X, c.Height);
                    c.SetBounds(c.Left, c.Top + e.Y, c.Width, c.Height - e.Y);
                    break;

                case EdgeEnum.BottomRight:
                    c.SetBounds(c.Left, c.Top, c.Width - (c.Width - e.X), c.Height);
                    c.SetBounds(c.Left, c.Top, c.Width, c.Height - (c.Height - e.Y));
                    break;

                case EdgeEnum.BottomLeft:
                    c.SetBounds(c.Left + e.X, c.Top, c.Width - e.X, c.Height);
                    c.SetBounds(c.Left, c.Top, c.Width, c.Height - (c.Height - e.Y));
                    break;

                case EdgeEnum.Left:
                    c.SetBounds(c.Left + e.X, c.Top, c.Width - e.X, c.Height);
                    break;

                case EdgeEnum.Right:
                    c.SetBounds(c.Left, c.Top, c.Width - (c.Width - e.X), c.Height);
                    break;

                case EdgeEnum.Top:
                    c.SetBounds(c.Left, c.Top + e.Y, c.Width, c.Height - e.Y);
                    break;

                case EdgeEnum.Bottom:
                    c.SetBounds(c.Left, c.Top, c.Width, c.Height - (c.Height - e.Y));
                    break;

                case EdgeEnum.Moving:
                    c.SetBounds(c.Left + e.X - mouseX, c.Top + e.Y - mouseY, c.Width, c.Height);
                    break;
                }
                c.ResumeLayout();
            }
            else
            {
                if (e.X > c.Width - (mWidth) & e.Y > c.Height - (mWidth)) //Bottom right corner
                {
                    c.Cursor = Cursors.SizeNWSE;
                    mEdge    = EdgeEnum.BottomRight;
                }
                else if (e.X <= mWidth & e.Y > c.Height - (mWidth)) //Bottom Left corner
                {
                    c.Cursor = Cursors.SizeNESW;
                    mEdge    = EdgeEnum.BottomLeft;
                }
                else if (e.X > c.Width - (mWidth) & e.Y <= mWidth) //Top Right corner
                {
                    c.Cursor = Cursors.SizeNESW;
                    mEdge    = EdgeEnum.TopRight;
                }
                else if (e.X <= mWidth & e.Y <= mWidth) //Top Left corner
                {
                    c.Cursor = Cursors.SizeNWSE;
                    mEdge    = EdgeEnum.TopLeft;
                }
                else if (e.X <= mWidth & e.Y >= c.Height / 2 - 4 & e.Y <= c.Height / 2 + 4) //left edge
                {
                    c.Cursor = Cursors.SizeWE;
                    mEdge    = EdgeEnum.Left;
                }
                else if (e.X >= c.Width - mWidth & e.Y >= c.Height / 2 - 4 & e.Y <= c.Height / 2 + 4) //right edge
                {
                    c.Cursor = Cursors.SizeWE;
                    mEdge    = EdgeEnum.Right;
                }
                else if (e.X >= c.Width / 2 - 4 & e.X <= c.Width / 2 + 4 & e.Y <= mWidth) //top edge
                {
                    c.Cursor = Cursors.SizeNS;
                    mEdge    = EdgeEnum.Top;
                }
                else if (e.X >= c.Width / 2 - 4 & e.X <= c.Width / 2 + 4 & e.Y >= c.Height - mWidth) //bottom edge
                {
                    c.Cursor = Cursors.SizeNS;
                    mEdge    = EdgeEnum.Bottom;
                }
                else if (e.X <= c.Width & e.Y <= c.Height) //move
                {
                    c.Cursor = Cursors.SizeAll;
                    mEdge    = EdgeEnum.Moving;
                    DrawOrangeSquares(c, g);
                }
                else                        //no edge
                {
                    c.Cursor = Cursors.Default;
                    mEdge    = EdgeEnum.None;
                }
            }
        }