Inheritance: LayoutFarm.UI.UIBox
Exemplo n.º 1
0
        LayoutFarm.CustomWidgets.MenuItem CreateMenuItem(int x, int y)
        {
            var mnuItem = new CustomWidgets.MenuItem(150, 20);

            mnuItem.SetLocation(x, y);
            //--------------------
            //1. create landing part
            var landPart = new LayoutFarm.CustomWidgets.Box(150, 20);

            landPart.BackColor = Color.OrangeRed;
            mnuItem.LandPart   = landPart;
            //--------------------------------------
            //add small px to land part
            //image
            //load bitmap with gdi+

            if (_arrowBmp == null)
            {
                _arrowBmp = _appHost.LoadImageAndBind("../Data/imgs/arrow_open.png");
            }
            LayoutFarm.CustomWidgets.ImageBox imgBox = new CustomWidgets.ImageBox(_arrowBmp.Width, _arrowBmp.Height);
            imgBox.ImageBinder = _arrowBmp;
            landPart.AddChild(imgBox);
            //--------------------------------------
            //if click on this image then
            imgBox.MouseDown += (s, e) =>
            {
                e.CancelBubbling = true;
                //1. maintenace parent menu***
                mnuItem.MaintenanceParentOpenState();
                //-----------------------------------------------
                if (mnuItem.IsOpened)
                {
                    mnuItem.Close();
                }
                else
                {
                    mnuItem.Open();
                }
            };
            imgBox.MouseUp += (s, e) =>
            {
                mnuItem.UnmaintenanceParentOpenState();
            };
            imgBox.LostMouseFocus += (s, e) =>
            {
                if (!mnuItem.MaintenceOpenState)
                {
                    mnuItem.CloseRecursiveUp();
                }
            };
            //--------------------------------------
            //2. float part
            var floatPart = new LayoutFarm.CustomWidgets.MenuBox(400, 100);

            floatPart.BackColor = Color.Gray;
            mnuItem.FloatPart   = floatPart;
            return(mnuItem);
        }
Exemplo n.º 2
0
 LayoutFarm.CustomWidgets.MenuItem CreateMenuItem(int x, int y)
 {
     var mnuItem = new CustomWidgets.MenuItem(150, 20);
     mnuItem.SetLocation(x, y);
     //--------------------
     //1. create landing part
     var landPart = new LayoutFarm.CustomWidgets.SimpleBox(150, 20);
     landPart.BackColor = Color.OrangeRed;
     mnuItem.LandPart = landPart;
     //--------------------------------------
     //add small px to land part
     //image
     //load bitmap with gdi+        
     
     if (arrowBmp == null)
     {
         arrowBmp = LoadImageBinder("../../Demo/arrow_open.png");
     }
     LayoutFarm.CustomWidgets.ImageBox imgBox = new CustomWidgets.ImageBox(arrowBmp.ImageWidth, arrowBmp.ImageHeight);
     imgBox.ImageBinder = arrowBmp;
     landPart.AddChild(imgBox);
     //--------------------------------------
     //if click on this image then
     imgBox.MouseDown += (s, e) =>
     {
         e.CancelBubbling = true;
         //1. maintenace parent menu***
         mnuItem.MaintenanceParentOpenState();
         //-----------------------------------------------
         if (mnuItem.IsOpened)
         {
             mnuItem.Close();
         }
         else
         {
             mnuItem.Open();
         }
     };
     imgBox.MouseUp += (s, e) =>
     {
         mnuItem.UnmaintenanceParentOpenState();
     };
     imgBox.LostMouseFocus += (s, e) =>
     {
         if (!mnuItem.MaintenceOpenState)
         {
             mnuItem.CloseRecursiveUp();
         }
     };
     //--------------------------------------
     //2. float part
     var floatPart = new LayoutFarm.CustomWidgets.MenuBox(400, 100);
     floatPart.BackColor = Color.Gray;
     mnuItem.FloatPart = floatPart;
     return mnuItem;
 }
Exemplo n.º 3
0
 public void AddSubMenuItem(MenuItem childItem)
 {
     if (childItems == null)
     {
         childItems = new List<MenuItem>();
     }
     this.childItems.Add(childItem);
     floatPart.AddChild(childItem);
     childItem.ParentMenuItem = this;
 }