Exemplo n.º 1
0
        void border_DragMovedEvent(object sender, int offsetX, int offsetY)
        {
            Size minimize = GetPreferedSize();

            DialogBorder db = sender as DialogBorder;

            if (db == borderLeft)
            {
                if ((Size.width - offsetX) > minimize.width)
                {
                    Position.X += offsetX;
                    Size.width -= (uint)offsetX;
                }
            }
            else if ((DialogBorder)sender == borderRight)
            {
                if ((Size.width + offsetX) > minimize.width)
                {
                    Size.width += (uint)offsetX;
                }
            }
            else if ((DialogBorder)sender == borderUp)
            {
                if ((Size.height - offsetY) > minimize.height)
                {
                    Position.Y  += offsetY;
                    Size.height -= (uint)offsetY;
                }
            }
            else if ((DialogBorder)sender == borderBottom)
            {
                if ((Size.height + offsetY) > minimize.height)
                {
                    Size.height += (uint)offsetY;
                }
            }
            else if ((DialogBorder)sender == borderUpLeft)
            {
                if ((Size.width - offsetX) > minimize.width)
                {
                    Position.X += offsetX;
                    Size.width -= (uint)offsetX;
                }
                if ((Size.height - offsetY) > minimize.height)
                {
                    Position.Y  += offsetY;
                    Size.height -= (uint)offsetY;
                }
            }
            else if ((DialogBorder)sender == borderBottomRight)
            {
                if ((Size.width + offsetX) > minimize.width)
                {
                    Size.width += (uint)offsetX;
                }
                if ((Size.height + offsetY) > minimize.height)
                {
                    Size.height += (uint)offsetY;
                }
            }
            else if ((DialogBorder)sender == borderUpRight)
            {
                if ((Size.width + offsetX) > minimize.width)
                {
                    Size.width += (uint)offsetX;
                }
                if ((Size.height - offsetY) > minimize.height)
                {
                    Position.Y  += offsetY;
                    Size.height -= (uint)offsetY;
                }
            }
            else if ((DialogBorder)sender == borderBottomLeft)
            {
                if ((Size.width - offsetX) > minimize.width)
                {
                    Position.X += offsetX;
                    Size.width -= (uint)offsetX;
                }
                if ((Size.height + offsetY) > minimize.height)
                {
                    Size.height += (uint)offsetY;
                }
            }

            Pack();

            Cursor.Current = currentCursor;
        }
Exemplo n.º 2
0
        public Dialog(String title, int x, int y, uint width, uint height)
        {
            tittleBar = new DialogTittleBar(title);

            top    = 12;
            bottom = 14;
            left   = 12;
            right  = 12;

            borderUpLeft      = new DialogBorder(9, 7, 4, 4);
            borderUpRight     = new DialogBorder((int)(width - 9 - 4), 7, 4, 4);
            borderUp          = new DialogBorder(13, 7, width - 26, 4);
            borderLeft        = new DialogBorder(9, 11, 4, height - 27);
            borderRight       = new DialogBorder((int)(width - 13), 11, 4, height - 27);
            borderBottomLeft  = new DialogBorder(9, (int)(height - 27), 4, 4);
            borderBottom      = new DialogBorder(13, (int)(height - 27), width - 26, 4);
            borderBottomRight = new DialogBorder((int)(width - 13), (int)(height - 27), 4, 4);

            dialogBorders[0] = borderUpLeft;
            dialogBorders[1] = borderUpRight;
            dialogBorders[2] = borderUp;
            dialogBorders[3] = borderLeft;
            dialogBorders[4] = borderRight;
            dialogBorders[5] = borderBottomLeft;
            dialogBorders[6] = borderBottom;
            dialogBorders[7] = borderBottomRight;

            Dragable  = true;
            Resizable = true;
            showType  = EShowType.None;

            Position.X  = x;
            Position.Y  = y;
            Size.width  = width;
            Size.height = height;

            Pack();

            tittleBar.DragMovedEvent += new DragMovedHandler(tittleBar_DragMovedEvent);

            borderLeft.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderLeft.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderLeft.DragMovedEvent    += new DragMovedHandler(border_DragMovedEvent);

            borderRight.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderRight.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderRight.DragMovedEvent    += new DragMovedHandler(border_DragMovedEvent);

            borderUp.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderUp.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderUp.DragMovedEvent    += new DragMovedHandler(border_DragMovedEvent);

            borderBottom.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderBottom.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderBottom.DragMovedEvent    += new DragMovedHandler(border_DragMovedEvent);
            //===========================================================================

            borderUpLeft.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderUpLeft.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderUpLeft.DragMovedEvent    += new DragMovedHandler(border_DragMovedEvent);

            borderUpRight.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderUpRight.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderUpRight.DragMovedEvent    += new DragMovedHandler(border_DragMovedEvent);

            borderBottomLeft.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderBottomLeft.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderBottomLeft.DragMovedEvent    += new DragMovedHandler(border_DragMovedEvent);

            borderBottomRight.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderBottomRight.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderBottomRight.DragMovedEvent    += new DragMovedHandler(border_DragMovedEvent);
        }
Exemplo n.º 3
0
        public Dialog(String title, int x, int y, uint width, uint height)
        {
            tittleBar = new DialogTittleBar(title);

            top = 12;
            bottom = 14;
            left = 12;
            right = 12;

            borderUpLeft = new DialogBorder(9, 7, 4, 4);
            borderUpRight = new DialogBorder((int)(width - 9 - 4), 7, 4, 4);
            borderUp = new DialogBorder(13, 7, width - 26, 4);
            borderLeft = new DialogBorder(9, 11, 4, height - 27);
            borderRight = new DialogBorder((int)(width - 13), 11, 4, height - 27);
            borderBottomLeft = new DialogBorder(9, (int)(height - 27), 4, 4);
            borderBottom = new DialogBorder(13, (int)(height - 27), width - 26, 4);
            borderBottomRight = new DialogBorder((int)(width - 13), (int)(height - 27), 4, 4);

            dialogBorders[0] = borderUpLeft;
            dialogBorders[1] = borderUpRight;
            dialogBorders[2] = borderUp;
            dialogBorders[3] = borderLeft;
            dialogBorders[4] = borderRight;
            dialogBorders[5] = borderBottomLeft;
            dialogBorders[6] = borderBottom;
            dialogBorders[7] = borderBottomRight;

            Dragable = true;
            Resizable = true;
            showType = EShowType.None;

            Position.X = x;
            Position.Y = y;
            Size.width = width;
            Size.height = height;

            Pack();

            tittleBar.DragMovedEvent += new DragMovedHandler(tittleBar_DragMovedEvent);

            borderLeft.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderLeft.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderLeft.DragMovedEvent += new DragMovedHandler(border_DragMovedEvent);

            borderRight.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderRight.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderRight.DragMovedEvent += new DragMovedHandler(border_DragMovedEvent);

            borderUp.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderUp.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderUp.DragMovedEvent += new DragMovedHandler(border_DragMovedEvent);

            borderBottom.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderBottom.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderBottom.DragMovedEvent += new DragMovedHandler(border_DragMovedEvent);
            //===========================================================================

            borderUpLeft.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderUpLeft.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderUpLeft.DragMovedEvent += new DragMovedHandler(border_DragMovedEvent);

            borderUpRight.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderUpRight.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderUpRight.DragMovedEvent += new DragMovedHandler(border_DragMovedEvent);

            borderBottomLeft.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderBottomLeft.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderBottomLeft.DragMovedEvent += new DragMovedHandler(border_DragMovedEvent);

            borderBottomRight.MouseEnteredEvent += new MouseEnteredHandler(border_MouseEvent);
            borderBottomRight.MousePressedEvent += new MousePressedHandler(border_MouseEvent);
            borderBottomRight.DragMovedEvent += new DragMovedHandler(border_DragMovedEvent);
        }