Пример #1
0
        protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
        {
            base.OnMouseMove(e);

            MenuBar bar = null;

            for (int i = 0; i < MenuBars.Count; i++)
            {
                MenuBar barTemp = MenuBars[i];
                // Check mouse is over on bar or menu items.
                if (barTemp.ContainsBarOrItemContent(e.Location))
                {
                    bar = barTemp;
                    break;
                }
            }

            // if found bar and item area that mouse is live.
            if (bar != null)
            {
                if (bar.ContainsBar(e.Location))
                {
                    // if mouse is over on MenuBar.

                    #region " Check Mouse is over on MenuBar "
                    if (MenuItemHover != null)
                    {
                        MenuItemHover = null;
                    }

                    // If old and current of menu bar are not equal.
                    if (MenuBarHover != bar)
                    {
                        // Change menu bar hover to new value.
                        MenuBarHover = bar;
                    }

                    #endregion
                }
                else
                {
                    // if mouse is over on MenuItem element of MenuBar.

                    #region " Check Mouse is over on MenuItem element of MenuBar "

                    // Clear menu bar hover.
                    if (MenuBarHover != null)
                    {
                        MenuBarHover = null;
                    }

                    if (bar.State == MenuBar.EState.Expanded)
                    {
                        // find menu item that mouse is over.
                        MenuItem tempItem = null;
                        for (int iMenuItem = 0; iMenuItem < bar.MenuItems.Count; iMenuItem++)
                        {
                            MenuItem item = bar.MenuItems[iMenuItem];
                            if (item.Contains(e.Location))
                            {
                                tempItem = item;
                                break;
                            }
                        }
                        MenuItemHover = tempItem;

                        //Raise event MenuItem mouse over.
                        OnMenuItemMouseOver(MenuItemHover);
                    }
                    else
                    {
                        MenuItemHover = null;
                    }

                    #endregion
                }
            }
            else
            {
                if (MenuBarHover != null)
                {
                    MenuBarHover = null;
                }

                if (MenuItemHover != null)
                {
                    MenuItemHover = null;
                }
            }



            this.Invalidate();
        }
Пример #2
0
        public void RaiseChangedLanguage()
        {
            this.SuspendLayout();

            //MenuSubList menuList = m_menuManager.GetMenu();
            List <MenuSub> menuList = m_menuController.LoadMenuHierachy();

            // Load buffer workflow document list.
            m_workflowDocumentList.Clear();
            for (int i = 0; i < menuList.Count; i++)
            {
                WorkflowDocument doc = WorkflowDocument.LoadDatabase(Common.CurrentDatabase, menuList[i].WORKFLOW_ID.NVL(String.Empty), Common.CurrentUserInfomation.UserCD);
                m_workflowDocumentList.Add(doc);
            }

            // Load Menu control.
            menuTree1.BeginUpdateMenuBar();
            menuTree1.ClearMenuBars();
            for (int i = 0; i < menuList.Count; i++)
            {
                MenuSub menuSub = menuList[i];

                MenuBar menuBar = new MenuBar();
                menuBar.Host = menuTree1;
                menuBar.Text = menuSub.MENU_SUB_DESC.NVL(string.Empty);
                menuBar.Tag  = menuSub;


                for (int iScreen = 0; iScreen < menuSub.MenuSubItemList.Count; iScreen++)
                {
                    MenuSubItemDTO menuSubItem = menuSub.MenuSubItemList[iScreen];

                    MenuItem menuItem = new MenuItem(menuBar);

                    DatabaseScreen dbScreen = m_databaseScreenCache[menuSubItem.SCREEN_CD.StrongValue];

                    if (dbScreen == null)
                    {
#if DEBUG
                        MessageDialog.ShowBusiness(this, "Not found screen code: " + menuSubItem.SCREEN_CD.StrongValue);
#endif
                        continue;
                    }
                    menuItem.Tag  = menuSubItem;
                    menuItem.Text = dbScreen.ScreenDescription.StrongValue;

                    ImageItem imgItem = m_imageCache.Get(dbScreen.ImageCD.NVL(String.Empty));
                    Image     img     = null;
                    if (imgItem != null)
                    {
                        img = imgItem.ImageBin;
                    }
                    if (img != null)
                    {
                        try
                        {
                            menuItem.Image = ImageHelper.GetThumbnailImage(img, 16, 16);
                        }
                        catch (Exception err)
                        {
                            MessageDialog.ShowBusiness(this, err.Message);
                        }
                    }
                    menuBar.MenuItems.Add(menuItem);
                }


                menuTree1.AddMenuBar(menuBar);
            }

            if (menuTree1.MenuBars.Count > 0)
            {
                menuTree1.MenuBarSelected = menuTree1.MenuBars[0];
            }

            menuTree1.EndUpdateMenuBar();

            // Load Favorite button
            flowFavorite.Controls.Clear();
            LoadFavorite();

            this.ResumeLayout(false);
        }
Пример #3
0
 private void menuTree1_MenuBarClick(object sender, MenuBar bar)
 {
 }
Пример #4
0
 public MenuItem(MenuBar parent)
 {
     m_parent = parent;
 }