/// <summary>
        /// 菜单鼠标悬停事件(panel)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void PanelMouseEnter(object sender, EventArgs e)
        {
            PanelEx selectionPanel = (PanelEx)sender;
            Label   label          = (Label)selectionPanel.Controls[0];

            //Log4net.LogHelper.Info("2" + PanMouseOriginally.Name);
            if (selectionPanel.BackColor != Color.FromArgb(26, 179, 148))
            {
                MouseOriginally          = selectionPanel.BackColor;
                selectionPanel.BackColor = Color.FromArgb(26, 179, 148);
                label.ForeColor          = Color.White;
            }
            tp.SetToolTip(label, label.Text.Replace("\r\n", ""));
        }
        Color MouseOriginally = Color.Transparent;//菜单原色

        /// <summary>
        /// 菜单鼠标悬停事件(label)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void LabelMouseEnter(object sender, EventArgs e)
        {
            Label   label          = (Label)sender;
            PanelEx selectionPanel = (PanelEx)label.Parent;

            if (selectionPanel.BackColor != Color.FromArgb(26, 179, 148))//尽量减少对界面的修改
            {
                MouseOriginally = selectionPanel.BackColor;
                //Log4net.LogHelper.Info("1" + LabMouseOriginally.Name);
                selectionPanel.BackColor = Color.FromArgb(26, 179, 148);
                label.ForeColor          = Color.White;
            }
            tp.SetToolTip(label, label.Text.Replace("\r\n", ""));
        }
예제 #3
0
        /// <summary>
        /// 菜单鼠标离开事件(label)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void TwoLevelMouseLeave(object sender, EventArgs e)
        {
            Label   label          = (Label)sender;
            PanelEx selectionPanel = (PanelEx)label.Parent;

            if (selectionPanel.BackColor != Color.FromArgb(24, 166, 137))
            {
                selectionPanel.BackColor = MouseOriginally;
            }
            if (selectionPanel.BackColor != Color.FromArgb(24, 166, 137) &&
                selectionPanel.BackColor != Color.FromArgb(26, 179, 148))
            {
                label.ForeColor = Color.Black;
            }
        }
예제 #4
0
        /// <summary>
        /// 菜单鼠标离开事件(panel)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void PanelMouseLeave(object sender, EventArgs e)
        {
            PanelEx selectionPanel = (PanelEx)sender;
            Label   label          = (Label)selectionPanel.Controls[0];

            if (selectionPanel.BackColor != Color.FromArgb(24, 166, 137))
            {
                selectionPanel.BackColor = MouseOriginally;
            }
            if (selectionPanel.BackColor != Color.FromArgb(24, 166, 137) &&
                selectionPanel.BackColor != Color.FromArgb(26, 179, 148))
            {
                label.ForeColor = Color.Black;
            }
        }
        /// <summary>
        /// 下拉收缩点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ExpansionContractionClicked(object sender, EventArgs e)
        {
            //下级菜单的显示隐藏
            Label   l1 = (Label)sender;
            PanelEx p1 = (PanelEx)l1.Parent;
            PanelEx p2 = (PanelEx)p1.Parent;
            PanelEx p3 = (PanelEx)p2.Controls[0];//因为添加控件使用了BringToFront,所以顺序要反着算

            if (p3.Visible)
            {
                l1.Text = "+";
            }
            else
            {
                l1.Text = "-";
            }
            p3.Visible = !p3.Visible;
        }
        /// <summary>
        /// 菜单点击事件(label)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void LabelMenuClicked(object sender, EventArgs e)
        {
            Label   selectionLabel = (Label)sender;                  //选中的Label
            PanelEx selectionPanel = (PanelEx)selectionLabel.Parent; //选中的面板

            //上一个选中的菜单颜色还原
            if (oldPanel != null)
            {
                oldPanel.BackColor = Color.Transparent;
                oldLabel.ForeColor = Color.Black;
            }

            //修改选择的菜单颜色
            selectionPanel.BackColor = Color.FromArgb(24, 166, 137);
            selectionLabel.ForeColor = Color.White;

            //保存当前选中的数据
            oldPanel = selectionPanel;
            oldLabel = selectionLabel;
            foreach (dynamic menu in dataSourceList)
            {
                String itemValue = menu.GetType().GetProperty(valueMember).GetValue(menu, null);
                if (itemValue.Equals(selectionLabel.Tag.ToString()))
                {
                    selectText = menu.GetType().GetProperty(displayMember).GetValue(menu, null);
                    selectItem = menu;
                    break;
                }
            }

            //使用本控件的点击事件
            if (MenuItemClick != null)
            {
                MenuItemClick(sender, new EventArgs(), selectItem);
            }
        }
        /// <summary>
        /// 菜单鼠标离开事件(panel)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void PanelMouseLeave(object sender, EventArgs e)
        {
            PanelEx selectionPanel = (PanelEx)sender;
            Label   label          = (Label)selectionPanel.Controls[0];

            //不是选中的菜单背景就恢复原色
            if (selectionPanel.BackColor != Color.FromArgb(24, 166, 137))
            {
                if (selectionPanel.BackColor != MouseOriginally)
                {
                    selectionPanel.BackColor = MouseOriginally;
                }
            }
            //不是选中并且鼠标悬浮菜单背景就恢复原色(黑色)
            if (selectionPanel.BackColor != Color.FromArgb(24, 166, 137) &&
                selectionPanel.BackColor != Color.FromArgb(26, 179, 148))
            {
                if (label.ForeColor != Color.Black)
                {
                    label.ForeColor = Color.Black;
                }
            }
            //Log4net.LogHelper.Info("22" + PanMouseOriginally.Name);
        }
        /// <summary>
        /// 创建下级菜单
        /// </summary>
        /// <param name="current">下级菜单的父节点</param>
        /// <param name="ParentPanel">下级菜单所在控件</param>
        /// <param name="ParentTop">下级菜单所在控件的头部</param>
        /// <param name="label">显示下级的‘+’号,目前后label,后期可能改成图片</param>
        private void createSubsetMenu(String current, PanelEx ParentPanel, PanelEx ParentTop, Label label)
        {
            int currentMenuLevel = menuLevel;               //记录当前菜单级别
            //找子集
            List <dynamic> menuList = new List <dynamic>(); //存子集

            foreach (dynamic menu in dataSourceList)
            {
                String menuParent = menu.GetType().GetProperty(parentFieldName).GetValue(menu, null);
                if (menuParent != null && menuParent.Equals(current))
                {
                    menuList.Add(menu);
                }
            }
            if (menuList.Count <= 0)
            {
                //没有子集的时候不显示+号
                label.Visible = false;
                Padding pd   = ParentTop.Padding;
                int     left = pd.Left;
                if (useZoom)
                {
                    left = pd.Left + 15;
                }
                ParentTop.Padding = new Padding(left, pd.Top, pd.Right, pd.Bottom);
                return;
            }
            else if (menuList.Count > 0)
            {
                //子菜单面板
                PanelEx p1 = new PanelEx();
                p1.BorderStyleTop    = ButtonBorderStyle.None;
                p1.BorderStyleBottom = ButtonBorderStyle.None;
                p1.BorderStyleLeft   = ButtonBorderStyle.None;
                p1.BorderStyleRight  = ButtonBorderStyle.None;
                p1.BorderColor       = Color.FromArgb(157, 160, 170);
                p1.Margin            = new Padding(0, 0, 0, 0);
                p1.Padding           = new Padding(0, 1, 0, 0);
                //panel23.Visible = false;
                p1.AutoSize = true;
                p1.Dock     = DockStyle.Top;

                //循环添加菜单
                foreach (dynamic menu in menuList)
                {
                    //子级菜单
                    PanelEx p2 = new PanelEx();//某个子集的面板
                    p2.BorderColor       = borderColor;
                    p2.BorderStyleTop    = ButtonBorderStyle.None;
                    p2.BorderStyleBottom = ButtonBorderStyle.None;
                    p2.BorderStyleRight  = ButtonBorderStyle.None;
                    p2.BorderStyleLeft   = ButtonBorderStyle.None;
                    p2.BackColor         = Color.Transparent;
                    p2.AutoSize          = true;
                    p2.Dock = DockStyle.Top;

                    PanelEx p3 = new PanelEx();//某个子集的选项头
                    p3.BorderColor       = borderColor;
                    p3.BorderStyleTop    = ButtonBorderStyle.None;
                    p3.BorderStyleBottom = ButtonBorderStyle.None;
                    p3.BorderStyleLeft   = ButtonBorderStyle.None;
                    p3.BorderStyleRight  = ButtonBorderStyle.None;
                    p3.BackColor         = Color.Transparent;
                    p3.Height            = MenuItemHeight;
                    p3.Dock = DockStyle.Top;

                    p3.Padding = new Padding((menuLevel - 1) * 15, 6, 1, 1);

                    Label l1 = new Label();//下拉收缩的控件
                    l1.Visible = useZoom;
                    l1.Text    = "-";
                    l1.Width   = 15;
                    l1.Font    = font;
                    l1.Dock    = DockStyle.Left;
                    l1.Click  += new EventHandler(ExpansionContractionClicked);
                    p3.Controls.Add(l1);

                    Label l2 = new Label();
                    //l2.BackColor = Color.Transparent;
                    l2.Font        = font;
                    l2.AutoSize    = true;
                    l2.Text        = menu.GetType().GetProperty(displayMember).GetValue(menu, null); //菜单显示的值
                    l2.Tag         = menu.GetType().GetProperty(valueMember).GetValue(menu, null);   //菜单对应的值
                    l2.Dock        = DockStyle.Left;
                    l2.MouseEnter += new EventHandler(LabelMouseEnter);
                    l2.MouseLeave += new EventHandler(LabelMouseLeave);
                    l2.Click      += new EventHandler(LabelMenuClicked);
                    p3.MouseEnter += new EventHandler(PanelMouseEnter);
                    p3.MouseLeave += new EventHandler(PanelMouseLeave);
                    p3.Click      += new EventHandler(PanelMenuClicked);
                    p3.Controls.Add(l2);
                    l2.BringToFront();
                    p2.Controls.Add(p3);
                    p1.Controls.Add(p2);
                    p2.BringToFront();

                    //创建下级菜单
                    menuLevel++;
                    current = menu.GetType().GetProperty(keyFieldName).GetValue(menu, null);
                    createSubsetMenu(current, p2, p3, l1);
                    menuLevel = currentMenuLevel;
                }
                ParentPanel.Controls.Add(p1);
                p1.BringToFront();
            }
        }
        /// <summary>
        /// 根据数据源生成界面
        /// </summary>
        private void createUI()
        {
            this.Controls.Clear();
            string type = dataSource.GetType().Name;

            switch (type)
            {
            case "DataSet":
                DataSet ds = (DataSet)dataSource;
                throw new ArgumentException("目前还不支持DataSet类型");

            //if (ds.Check())
            //{
            //    rp.DataSource = ds.Tables[0];
            //}
            //break;
            case "DataTable":
                DataTable dt = (DataTable)dataSource;
                throw new ArgumentException("目前还不支持DataTable类型");

            //if (dt.Rows.Count > 0)
            //{
            //    rp.DataSource = dt;
            //}
            //break;
            case "List`1":
                //第一步:找出一级菜单列表
                List <dynamic> dyList = new List <dynamic>();  //存一级菜单
                IEnumerable    list   = dataSource as IEnumerable;
                foreach (var item in list)
                {
                    dynamic temp = item;
                    dataSourceList.Add(item);
                    if (ifTopLevel(temp))
                    {
                        dyList.Add(temp);
                    }
                }
                //第二步:生成菜单控件
                //遍历生成一级菜单
                foreach (dynamic entity in dyList)
                {
                    //选项,包括该选项的所有字菜单
                    PanelEx p1 = new PanelEx();
                    p1.BorderColor       = borderColor;
                    p1.BorderStyleTop    = ButtonBorderStyle.None;
                    p1.BorderStyleBottom = ButtonBorderStyle.None;
                    p1.BorderStyleRight  = ButtonBorderStyle.None;
                    p1.BorderStyleLeft   = ButtonBorderStyle.None;
                    p1.BackColor         = Color.Transparent;
                    p1.AutoSize          = true;
                    p1.Dock = DockStyle.Top;
                    //当前选项头
                    PanelEx p2 = new PanelEx();
                    p2.BorderColor       = borderColor;
                    p2.BorderStyleTop    = ButtonBorderStyle.None;
                    p2.BorderStyleLeft   = ButtonBorderStyle.None;
                    p2.BorderStyleRight  = ButtonBorderStyle.None;
                    p2.BorderStyleBottom = ButtonBorderStyle.None;
                    p2.Margin            = new Padding(0, 0, 0, 0);
                    p2.Padding           = new Padding(0, 6, 0, 0);
                    p2.Height            = MenuItemHeight;
                    p2.Dock = DockStyle.Top;
                    Label l1 = new Label();    //下拉收缩的控件
                    l1.Visible = useZoom;
                    l1.Text    = "-";
                    l1.Width   = 15;
                    l1.Font    = font;
                    l1.Dock    = DockStyle.Left;
                    l1.Click  += new EventHandler(ExpansionContractionClicked);
                    p2.Controls.Add(l1);
                    //当前选项文本
                    Label l2 = new Label();
                    l2.Text        = entity.GetType().GetProperty(displayMember).GetValue(entity, null); //菜单显示的值
                    l2.Tag         = entity.GetType().GetProperty(valueMember).GetValue(entity, null);   //菜单对应的值
                    l2.Font        = font;
                    l2.Dock        = DockStyle.Left;
                    l2.MouseEnter += new EventHandler(LabelMouseEnter);
                    l2.MouseLeave += new EventHandler(LabelMouseLeave);
                    l2.Click      += new EventHandler(LabelMenuClicked);
                    p2.MouseEnter += new EventHandler(PanelMouseEnter);
                    p2.MouseLeave += new EventHandler(PanelMouseLeave);
                    p2.Click      += new EventHandler(PanelMenuClicked);
                    p2.Controls.Add(l2);
                    l2.BringToFront();
                    p1.Controls.Add(p2);

                    //创建下级菜单
                    menuLevel++;
                    String current = entity.GetType().GetProperty(keyFieldName).GetValue(entity, null);
                    createSubsetMenu(current, p1, p2, l1);
                    menuLevel = 1;

                    this.Controls.Add(p1);
                    p1.BringToFront();
                }
                break;

            default:
                break;
            }
        }
예제 #10
0
        /// <summary>
        /// Creates the waiting box.
        /// </summary>
        private void CreateWaitingBox()
        {
            if (!this._IsWaitingBoxCreated)
            {
                #region CreateWaitingBox

                this.waitingBox = new System.Windows.Forms.Panel();
                //ControlHelper.BindMouseMoveEvent(this.waitingBox);
                waitingBox.BackColor = Color.WhiteSmoke;

                if (!Control.Contains(waitingBox))
                {
                    _Loading = new ProgressPanel();
                    //_Loading.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple;
                    _Loading.Appearance.BackColor                  = System.Drawing.Color.FromArgb(60, Color.WhiteSmoke);
                    _Loading.Appearance.Font                       = new System.Drawing.Font("Tahoma", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    _Loading.Appearance.ForeColor                  = System.Drawing.Color.Black;
                    _Loading.Appearance.Options.UseBackColor       = true;
                    _Loading.Appearance.Options.UseFont            = true;
                    _Loading.Appearance.Options.UseForeColor       = true;
                    _Loading.AppearanceCaption.Font                = new System.Drawing.Font("Microsoft Sans Serif", 12F);
                    _Loading.AppearanceCaption.Options.UseFont     = true;
                    _Loading.AppearanceDescription.Font            = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
                    _Loading.AppearanceDescription.Options.UseFont = true;
                    _Loading.Size        = new System.Drawing.Size(223, 53);
                    _Loading.Caption     = _text;
                    _Loading.Description = "";
                    //_Loading.Dock = System.Windows.Forms.DockStyle.Fill;
                    _Loading.Margin  = new System.Windows.Forms.Padding(2, 2, 2, 2);
                    _Loading.Name    = "progressPanel1";
                    _Loading.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
                    //_Loading.Size = new System.Drawing.Size(223, 53);
                    //_Loading.Location = new Point((Control.Width - _Loading.Width) / 2,  (Control.Height - _Loading.Height) / 2);//居中
                    _Loading.Dock = DockStyle.Top;
                    _Loading.LookAndFeel.SkinName = "Visual Studio 2013 Light";
                    _Loading.LookAndFeel.UseDefaultLookAndFeel = false;

                    _Loading.TabIndex = 0;
                    _Loading.Text     = "progressPanel1";

                    pe             = new PanelEx();
                    pe.Size        = new System.Drawing.Size(223, 75);
                    pe.Location    = new Point((Control.Width - _Loading.Width) / 2, (Control.Height - _Loading.Height) / 2);//居中
                    pe.BorderColor = Color.LightGray;
                    pe.Controls.Add(_Loading);
                    waitingBox.Controls.Add(pe);
                    Control.Controls.Add(waitingBox);
                    //取消按钮
                    buttonControl = new Xr.Common.Controls.ButtonControl();

                    buttonControl.BackColor      = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(245)))), ((int)(((byte)(245)))));
                    buttonControl.Dock           = DockStyle.None;
                    buttonControl.ForeColor      = System.Drawing.Color.FromArgb(((int)(((byte)(42)))), ((int)(((byte)(131)))), ((int)(((byte)(113)))));
                    buttonControl.HoverBackColor = System.Drawing.Color.Empty;
                    buttonControl.Location       = new Point((pe.Width - buttonControl.Width) / 2 + 10, _Loading.Height);//居中
                    buttonControl.Margin         = new System.Windows.Forms.Padding(5, 0, 5, 0);
                    buttonControl.Size           = new System.Drawing.Size(50, 20);
                    buttonControl.Style          = Xr.Common.Controls.ButtonStyle.Return;
                    buttonControl.TabIndex       = 90;
                    buttonControl.TabStop        = false;
                    buttonControl.Text           = "取消";
                    buttonControl.Click         += new System.EventHandler(this.button_Click);
                    pe.Controls.Add(buttonControl);
                }

                waitingBox.Show();
                this._IsWaitingBoxCreated = true;
                #endregion
            }
            _Loading.Caption = _text;
            if (IsShowCancelBtn)
            {
                if (buttonControl != null)
                {
                    buttonControl.Visible = true;
                    pe.Size = new System.Drawing.Size(223, 75);
                }
            }
            else
            {
                if (buttonControl != null)
                {
                    buttonControl.Visible = false;
                    pe.Size = new System.Drawing.Size(223, 52);
                }
            }
            if (status == false)
            {
                Rectangle rect = Control.DisplayRectangle;
                if (rectDisplay == new Rectangle())
                {
                    rect = Control.DisplayRectangle;
                }

                else
                {
                    rect                   = rectDisplay;
                    pe.Location            = new Point((rect.Width - _Loading.Width) / 2, (rect.Height - _Loading.Height) / 2); //居中
                    buttonControl.Location = new Point((pe.Width - buttonControl.Width) / 2 + 10, _Loading.Height);             //居中
                }
                waitingBox.Width    = rect.Width;
                waitingBox.Height   = rect.Height;
                waitingBox.Location = new Point(rect.X, rect.Y);

                if (IsShowtransparencyBG)
                {
                    waitingBox.BackgroundImage = this.CreateBacgroundImage();
                    //waitingBox.BackgroundImage = Properties.Resources.logo_mini;
                    waitingBox.BackgroundImageLayout = ImageLayout.Stretch;
                }
                if (_alpha != 0f)
                {
                    waitingBox.BackgroundImage = this.CreateBacgroundImage();
                    //waitingBox.BackgroundImage = Properties.Resources.logo_mini;
                    waitingBox.BackgroundImageLayout = ImageLayout.Stretch;
                }
            }

            waitingBox.Visible = true;
            waitingBox.BringToFront();
            waitingBox.Focus();
            status = true;
        }
예제 #11
0
        public void setDataSource(List <Item> menuList)
        {
            panelEx1.Controls.Clear();
            labMeasure.Font = font;
            dataSource      = menuList;
            if (isSort)
            {
                //排序菜单
                menuList = menuList.OrderBy(x => x.sort).ToList();
            }

            Graphics graphics = CreateGraphics();

            //循环添加菜单
            for (int i = menuList.Count - 1; i >= 0; i--)
            {
                Item    item      = menuList[i];
                PanelEx itemPanel = new PanelEx();
                itemPanel.BorderColor       = borderColor;
                itemPanel.BorderStyleTop    = ButtonBorderStyle.None;
                itemPanel.BorderStyleBottom = ButtonBorderStyle.None;
                itemPanel.BorderStyleLeft   = ButtonBorderStyle.None;

                if (item.spcialBColor != null && item.spcialBColor == "Red")
                {
                    itemPanel.Tag       = "Color#RED#";
                    itemPanel.BackColor = Color.FromArgb(180, 219, 112, 147);// Color.Transparent;
                }
                else
                {
                    itemPanel.BackColor = Color.Transparent;
                }
                itemPanel.Height = MenuItemHeight;
                itemPanel.Dock   = DockStyle.Top;
                if (item.parentId != null && item.parentId.Length != 0)
                {
                    itemPanel.Padding = new Padding(20, 6, 10, 1);
                }
                else
                {
                    itemPanel.Padding = new Padding(10, 6, 10, 1);
                }
                Label label = new Label();
                label.BackColor = Color.Transparent;
                label.Font      = font;
                label.Name      = item.value;
                label.Tag       = item.tag;
                label.Dock      = DockStyle.Fill;
                //label.AutoSize = false;
                label.Text = item.name;
                if (item.Enable)//可设置Item为无效从而不响应事件
                {
                    label.Click      += new EventHandler(MenuClicked);
                    label.MouseEnter += new EventHandler(TwoLevelMouseEnter);
                    label.MouseLeave += new EventHandler(TwoLevelMouseLeave);

                    itemPanel.Click      += new EventHandler(PanelMenuClicked);
                    itemPanel.MouseEnter += new EventHandler(PanelMouseEnter);
                    itemPanel.MouseLeave += new EventHandler(PanelMouseLeave);
                }
                itemPanel.Controls.Add(label);
                panelEx1.Controls.Add(itemPanel);
                //panelEx1.BringToFront();
                //String name = ""; //重新组织的字符串
                //float currentLineWidth = 0f; //当前行文字宽度
                //float rowWidht = this.Width - 20; //行宽度,不能取label的,不知道什么原因,取label比实际的小
                //int row = 0; //多加的行数
                //int textHeight = 0; //字的高度
                //labMeasure.Text = item.name;
                //for (int i = 0; i < item.name.Length; i++)
                //{
                //    labMeasure.Text = item.name.Substring(i, 1);
                //    textHeight = (int)labMeasure.Height;
                //    currentLineWidth += labMeasure.Width-9; //label左右内边距加起来为9
                //    if (currentLineWidth+9 < rowWidht || currentLineWidth+9 == rowWidht)//比较要加上边距
                //    {
                //        name += item.name.Substring(i, 1);
                //    }
                //    else
                //    {
                //        name += "\r\n" + item.name.Substring(i, 1);
                //        currentLineWidth = 0f;
                //        row += 1;
                //    }
                //}
                //label.Text = name;
                //itemPanel.Height = MenuItemHeight + textHeight * row;
            }
        }
예제 #12
0
        public void setDataSources(List <string> menuList, bool BorderColor, string spcialBColor)
        {
            labMeasure.Font = font;
            dataSources     = menuList;
            //if (isSort)
            //{
            //    //排序菜单
            //    menuList = menuList.OrderBy(x => x.sort).ToList();
            //}
            if (menuList == null)
            {
                panelEx1.Controls.Clear();
                return;
            }
            Graphics graphics = CreateGraphics();

            panelEx1.Controls.Clear();//先清空一遍 防止重复添加
            //循环添加菜单
            foreach (string item in menuList)
            {
                PanelEx itemPanel = new PanelEx();
                itemPanel.Controls.Clear();
                itemPanel.BorderColor       = this.borderColor;
                itemPanel.BorderStyleTop    = ButtonBorderStyle.None;
                itemPanel.BorderStyleBottom = ButtonBorderStyle.None;
                itemPanel.BorderStyleLeft   = ButtonBorderStyle.None;
                if (spcialBColor != null && spcialBColor == "Red")
                {
                    itemPanel.Tag       = "Color#RED#";
                    itemPanel.BackColor = Color.FromArgb(180, 219, 112, 147);// Color.Transparent;
                }
                else
                {
                    itemPanel.BackColor = Color.Transparent;
                }
                itemPanel.Height  = MenuItemHeight;
                itemPanel.Dock    = DockStyle.Top;
                itemPanel.Padding = new Padding(10, 6, 10, 1);
                Label label = new Label();
                label.BackColor = Color.Transparent;
                label.Font      = font;
                //label.Name = item.value;
                //label.Tag = item.tag;
                label.Dock = DockStyle.Fill;
                //label.AutoSize = false;
                label.Text        = item.ToString();
                label.Click      += new EventHandler(MenuClicked);
                label.MouseEnter += new EventHandler(TwoLevelMouseEnter);
                label.MouseLeave += new EventHandler(TwoLevelMouseLeave);
                itemPanel.Controls.Add(label);
                panelEx1.Controls.Add(itemPanel);
                panelEx1.BringToFront();
                if (BorderColor)
                {
                    this.BorderStyle           = BorderStyle.None;
                    panelEx1.BorderStyleBottom = ButtonBorderStyle.None;
                    panelEx1.BorderStyleLeft   = ButtonBorderStyle.None;
                    panelEx1.BorderStyleRight  = ButtonBorderStyle.None;
                    panelEx1.BorderStyleTop    = ButtonBorderStyle.None;
                }
            }
        }