Inheritance: LayoutFarm.CustomWidgets.EaseBox
Exemple #1
0
        void SetupSelectionBoxProperties(UISelectionBox selectionBox)
        {
            selectionBox.MouseUp += (s, e) =>
            {
                if (selectionBoxIsShown)
                {
                    FindSelectedUserBoxes();
                    selectionBox.Visible = false;
                    selectionBox.SetSize(1, 1);
                    selectionBoxIsShown = false;
                }
                e.StopPropagation();
            };
            selectionBox.MouseDrag += (s, e) =>
            {
                if (selectionBoxIsShown)
                {
                    Point pos = selectionBox.LandingPoint;

                    int x = pos.X;
                    int y = pos.Y;
                    //temp fix here
                    //TODO: get global position of selected box

                    int w = (selectionBox.Left + e.X) - pos.X;
                    int h = (selectionBox.Top + e.Y) - pos.Y;

                    if (w < 0)
                    {
                        w  = -w;
                        x -= w;
                    }
                    if (h < 0)
                    {
                        h  = -h;
                        y -= h;
                    }
                    //set width and height
                    selectionBox.SetBounds(x, y, w, h);
                }
                e.StopPropagation();
            };
        }
        protected override void OnStartModule()
        {
            this.rootgfx = viewport.RootGfx;
            //--------------------------------


            dzBoardBg = new DesingBoardBackground(800, 600);
            dzBoardBg.DesignBoardModule = this;
            dzBoardBg.BackColor         = Color.White;
            dzBoardBg.SetLocation(0, 0);
            SetupBackgroundProperties(dzBoardBg);
            viewport.AddContent(dzBoardBg);
            //--------------------------------

            selectionBox           = new UISelectionBox(1, 1);
            selectionBox.Visible   = false;
            selectionBox.BackColor = Color.FromArgb(80, Color.Green);
            viewport.AddContent(selectionBox);
            SetupSelectionBoxProperties(selectionBox);
        }
        void SetupSelectionBoxProperties(UISelectionBox selectionBox)
        {
            selectionBox.MouseUp += (s, e) =>
            {
                if (selectionBoxIsShown)
                {
                    FindSelectedUserBoxes();
                    selectionBox.Visible = false;
                    selectionBox.SetSize(1, 1);
                    selectionBoxIsShown = false;
                }
                e.StopPropagation();
            };
            selectionBox.MouseDrag += (s, e) =>
            {
                if (selectionBoxIsShown)
                {
                    Point pos = selectionBox.LandingPoint;
                    int x = pos.X;
                    int y = pos.Y;
                    //temp fix here 
                    //TODO: get global position of selected box

                    int w = (selectionBox.Left + e.X) - pos.X;
                    int h = (selectionBox.Top + e.Y) - pos.Y;
                    if (w < 0)
                    {
                        w = -w;
                        x -= w;
                    }
                    if (h < 0)
                    {
                        h = -h;
                        y -= h;
                    }
                    //set width and height
                    selectionBox.SetBounds(x, y, w, h);
                }
                e.StopPropagation();
            };
        }
        protected override void OnStartModule()
        {
            this.rootgfx = viewport.ViewportControl.RootGfx;
            //--------------------------------


            dzBoardBg = new DesingBoardBackground(800, 600);
            dzBoardBg.DesignBoardModule = this;
            dzBoardBg.BackColor = Color.White;
            dzBoardBg.SetLocation(0, 0);
            SetupBackgroundProperties(dzBoardBg);
            viewport.AddContent(dzBoardBg);
            //--------------------------------

            selectionBox = new UISelectionBox(1, 1);
            selectionBox.Visible = false;
            selectionBox.BackColor = Color.FromArgb(80, Color.Green);
            viewport.AddContent(selectionBox);
            SetupSelectionBoxProperties(selectionBox);
        }