Exemplo n.º 1
0
        public static bool Resize_MouseDown(object sender, MouseEventArgs e)
        {
            if (host != null && Derma.GetSelected() == host && !host.locked && host.sizable && host.sizablex && Derma.IsMouseOverArea(host.x + host.width - halfSize - 2, host.y + host.height / 2 - halfSize, 16, 16))
            {
                resizing      = true;
                resizingx     = true;
                mouseOrigin.X = e.X;
                mouseOrigin.Y = e.Y;
                return(true);
            }
            else if (host != null && Derma.GetSelected() == host && !host.locked && host.sizable && host.sizabley && Derma.IsMouseOverArea(host.x + host.width / 2 - halfSize, host.y + host.height - halfSize - 2, 16, 16))
            {
                resizing      = true;
                resizingy     = true;
                mouseOrigin.X = e.X;
                mouseOrigin.Y = e.Y;
                return(true);
            }
            else if (host != null && Derma.GetSelected() == host && !host.locked && host.sizable && host.sizablex && host.sizabley && Derma.IsMouseOverArea(host.x + host.width - twoThirdsSize, host.y + host.height - twoThirdsSize, 16, 16))
            {
                resizing      = true;
                resizinga     = true;
                mouseOrigin.X = e.X;
                mouseOrigin.Y = e.Y;
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        private void menuItem40_Click(object sender, EventArgs e)
        {
            if (Derma.GetSelected() && Derma.GetSelected().hasParent&& Derma.GetSelected().parent)
            {
                Derma.GetSelected().UnParent();
            }

            Derma.Repaint();
        }
Exemplo n.º 3
0
        public static void Paint(object sender, PaintEventArgs e)
        {
            if (host != null && Derma.GetSelected() == host && host.sizable)
            {
                // set the clip so we can actually see ourself...
                if (host.sizable && host.sizablex && host.sizabley)
                {
                    e.Graphics.Clip = new Region(new Rectangle(host.x + host.width - twoThirdsSize, host.y + host.height - twoThirdsSize, 16, 16));
                    e.Graphics.DrawImage(grip, host.x + host.width - twoThirdsSize, host.y + host.height - twoThirdsSize, 16, 16);
                }

                if (host.sizabley)
                {
                    e.Graphics.Clip = new Region(new Rectangle(host.x + host.width / 2 - halfSize, host.y + host.height - halfSize - 2, 16, 16));
                    e.Graphics.DrawImage(gripb, host.x + host.width / 2 - halfSize, host.y + host.height - halfSize - 2, 16, 16);
                }

                if (host.sizablex)
                {
                    e.Graphics.Clip = new Region(new Rectangle(host.x + host.width - halfSize - 2, host.y + host.height / 2 - halfSize, 16, 16));
                    e.Graphics.DrawImage(gripr, host.x + host.width - halfSize - 2, host.y + host.height / 2 - halfSize, 16, 16);
                }
            }
        }
Exemplo n.º 4
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (Derma.GetSelected() == null)
            {
                return;
            }

            if (e.KeyValue == (int)Keys.Delete)
            {
                Derma.GetSelected().Remove();
                Derma.prop.propertyGrid.SelectedObject = null;
                return;
            }

            int dist;

            if ((e.Modifiers & Keys.Shift) == Keys.Shift)
            {
                dist = 10;
            }
            else
            {
                dist = 1;
            }

            switch (e.KeyValue)
            {
            case (int)Keys.Up:
                if (GUI.Grid.DrawGrid && !VirtualKeys.IsKeyPressed(VirtualKeyStates.VK_TAB))
                {
                    dist = Derma.GetSelected().y % GUI.Grid.GridSize;
                    if (dist == 0)
                    {
                        dist = GUI.Grid.GridSize;
                    }
                    if (VirtualKeys.IsKeyPressed(VirtualKeyStates.VK_SHIFT))
                    {
                        dist += GUI.Grid.GridSize;
                    }
                }
                Derma.GetSelected().ModifyPos(0, -dist);
                break;

            case (int)Keys.Left:
                if (GUI.Grid.DrawGrid && !VirtualKeys.IsKeyPressed(VirtualKeyStates.VK_TAB))
                {
                    dist = Derma.GetSelected().x % GUI.Grid.GridSize;
                    if (dist == 0)
                    {
                        dist = GUI.Grid.GridSize;
                    }
                    if (VirtualKeys.IsKeyPressed(VirtualKeyStates.VK_SHIFT))
                    {
                        dist += GUI.Grid.GridSize;
                    }
                }
                Derma.GetSelected().ModifyPos(-dist, 0);
                break;

            case (int)Keys.Right:
                if (GUI.Grid.DrawGrid && !VirtualKeys.IsKeyPressed(VirtualKeyStates.VK_TAB))
                {
                    dist = Derma.GetSelected().x % GUI.Grid.GridSize;
                    if (dist == 0)
                    {
                        dist = GUI.Grid.GridSize;
                    }
                    if (VirtualKeys.IsKeyPressed(VirtualKeyStates.VK_SHIFT))
                    {
                        dist += GUI.Grid.GridSize;
                    }
                }
                Derma.GetSelected().ModifyPos(dist, 0);
                break;

            case (int)Keys.Down:
                if (GUI.Grid.DrawGrid && !VirtualKeys.IsKeyPressed(VirtualKeyStates.VK_TAB))
                {
                    dist = Derma.GetSelected().y % GUI.Grid.GridSize;
                    if (dist == 0)
                    {
                        dist = GUI.Grid.GridSize;
                    }
                    if (VirtualKeys.IsKeyPressed(VirtualKeyStates.VK_SHIFT))
                    {
                        dist += GUI.Grid.GridSize;
                    }
                }
                Derma.GetSelected().ModifyPos(0, dist);
                break;
            }

            Derma.RefreshProperties();
        }