Exemplo n.º 1
0
        //-------------

        public void SetPosition(int x, int y)
        {
            //TODO: review here again***
            //temp fix for invalidate area of overlap children
            _groundBox.InvalidateOuterGraphics();
            foreach (var ctrl in _controls)
            {
                ctrl.InvalidateOuterGraphics();
            }
            _groundBox.SetLocation(x, y);
        }
Exemplo n.º 2
0
        protected override void OnStart(AppHost host)
        {
            var box_beh = new UIMouseBehaviour <Box>();
            {
                box_beh.GuestMsg += (s, e) =>
                {
                };
                box_beh.MouseDown += (s, e) =>
                {
                    e.MouseCursorStyle = MouseCursorStyle.Pointer;
                };
                box_beh.MouseUp += (s, e) =>
                {
                    e.MouseCursorStyle = MouseCursorStyle.Default;
                    //box.BackColor = Color.LightGray;
                    s.Source.BackColor = Color.FromArgb(50, KnownColors.FromKnownColor(KnownColor.DeepSkyBlue));
                };
                box_beh.MouseDrag += (s, e) =>
                {
                    Box box = s.Source;
                    box.BackColor = Color.FromArgb(180, KnownColors.FromKnownColor(KnownColor.GreenYellow));
                    Point pos = box.Position;
                    box.SetLocation(pos.X + e.XDiff, pos.Y + e.YDiff);
                    e.MouseCursorStyle = MouseCursorStyle.Pointer;
                    e.CancelBubbling   = true;
                };
            }

            //-------------
            {
                var box1 = new LayoutFarm.CustomWidgets.Box(50, 50);
                box1.BackColor = Color.Red;
                box1.SetLocation(10, 10);
                box_beh.AttachSharedBehaviorTo(box1);
                host.AddChild(box1);
            }
            //--------------------------------
            {
                var box2 = new LayoutFarm.CustomWidgets.Box(30, 30);
                box2.SetLocation(50, 50);
                //box2.dbugTag = 2;
                box_beh.AttachSharedBehaviorTo(box2);
                host.AddChild(box2);
            }
        }
Exemplo n.º 3
0
        protected override void OnStart(AppHost host)
        {
            int halfW = host.PrimaryScreenWidth / 2;
            int halfH = host.PrimaryScreenHeight / 2;

            _rootPanel = new Box(halfW, halfH);
            _rootPanel.SetLocation(0, 0);
            host.AddChild(_rootPanel);

            var addWidthBtn = new Box(100, 50);
            var label1      = new Label();

            label1.Text = "+";
            label1.TransparentForMouseEvents = true;
            addWidthBtn.Add(label1);
            addWidthBtn.MouseDown += AddWidthBtn_MouseDown;
            addWidthBtn.SetLocation(0, halfH + 50);
            host.AddChild(addWidthBtn);

            var minusWidthBtn = new Box(100, 50);

            var label2 = new Label();

            label2.Text = "-";
            label2.TransparentForMouseEvents = true;
            minusWidthBtn.Add(label2);
            minusWidthBtn.MouseDown += MinusWidthBtn_MouseDown;
            minusWidthBtn.SetLocation(120, halfH + 50);
            host.AddChild(minusWidthBtn);

            //Init1();
            //Init2();

            //Init2_1();
            Init2_2();
            //Init2_3();

            _rootPanel.LayoutInstance = _rootNode.ToLayoutInstance();
        }