public UnmaintenanceParentOpenState ( ) : void | ||
return | void |
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); }
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; }