示例#1
0
        public ucMenuLeft()
        {
            InitializeComponent();

            ButtonInfo info = new ButtonInfo();

            info.ModuleName = homeText;
            info.Image1     = "0";
            info.Image2     = "1";

            tsbMaxMin.Tag  = info;
            tsbMaxMin.Text = homeText;
        }
示例#2
0
        /// <summary>
        /// 添加按键按键
        /// </summary>
        /// <param name="info"></param>
        /// <param name="index"></param>
        private void GetButton(ButtonInfo info, int index)
        {
            var tsb = new ToolStripButton();

            tsb.ForeColor             = System.Drawing.Color.White;
            tsb.ImageTransparentColor = System.Drawing.Color.Magenta;
            tsb.Size   = new System.Drawing.Size(90, 36);
            tsb.Text   = " " + info.ModuleName;
            tsb.Name   = "tsb" + index;
            tsb.Margin = new System.Windows.Forms.Padding(5);

            //if (index + 1 < imageList1.Images.Count)
            tsb.Image = imageList1.Images[info.ModuleName];

            tsb.Click += this.Button_Click;
            tsb.Tag    = info;
            this.toolStrip1.Items.Add(tsb);
        }
示例#3
0
        /// <summary>
        /// 初始化左侧一级导航
        /// </summary>
        public void Init()
        {
            ButtonInfo info;

            LoadImage(Application.StartupPath + "\\Images\\导航图标\\");
            for (int i = 0; i < CommonFrame.NavigationDataSource.Tables[0].Rows.Count; i++)
            {
                info = new ButtonInfo();

                info.ModuleCode = CommonFrame.NavigationDataSource.Tables[0].Rows[i]["ModuleCode"].ToString();
                info.ModuleName = CommonFrame.NavigationDataSource.Tables[0].Rows[i]["ModuleName"].ToString();
                //info.Image1 = "Home.jpg";
                //info.Image2 = "Home.jpg";

                GetButton(info, i + 1);
            }

            InitHandEvent();
        }
示例#4
0
        //所有按钮的单击事件
        private void Button_Click(object sender, EventArgs e)
        {
            if (ButtonClick != null)
            {
                ButtonInfo info = (ButtonInfo)((ToolStripButton)sender).Tag;
                ButtonClick(info.ModuleCode, info.ModuleName);
                if (selecteItem != null)
                {
                    ((ToolStripButton)selecteItem).BackColor = Color.Teal;
                    ((ToolStripButton)selecteItem).ForeColor = Color.White;
                }

                ((ToolStripButton)sender).BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(205)))), ((int)(((byte)(254)))));
                ((ToolStripButton)sender).ForeColor = Color.White;


                selecteItem = sender;
            }
        }