Exemplo n.º 1
0
 /// <summary>
 /// 展开/折叠
 /// </summary>
 void ibtn_Click(object sender, EventArgs e)
 {
     if (!(sender is Control))
     {
         return;                             
     }            
     Control ctl = sender as Control;
     PanelEx pnl = null;
     if (ctl is ImageButton)
     {
         str_Curr_Item = ctl.Name.Substring(5, ctl.Name.Length - 5);
         pnl = ctl.Parent as PanelEx;
     }
     else if (ctl is Label)
     {
         str_Curr_Item = ctl.Name.Substring(4, ctl.Name.Length - 4);
         pnl = ctl.Parent as PanelEx;
     }
     else if (ctl is PanelEx)
     {
         str_Curr_Item = ctl.Name.Substring(4, ctl.Name.Length - 4);
         pnl = ctl as PanelEx;
     }
     if (pnl == null)
     {
         return;
     }
     
     if (ctl.Tag.ToString() == "0")//展开
     {
         if (_prePanelEx != null)
         {
             _prePanelEx.BackColor = _normalColor;
         }
         pnl.BackColor = _lightColor;
         _prePanelEx = pnl;
         LeftMenuState(str_Curr_Item, SYSModel.clsSysConfig.STR_CURR_MEMU);
     }
     else//折叠
     {                
         pnl.BackColor = _normalColor;
         LeftMenuState("", SYSModel.clsSysConfig.STR_CURR_MEMU);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 清空查询面板中条件控件的值
 /// </summary>
 /// <param name="pnlQuery"></param>
 public static void ClearQueryControlValue(PanelEx pnlQuery)
 {
     if (pnlQuery != null)
     {
         foreach (var control in pnlQuery.Controls)
         {
             if (control.GetType() == typeof(TextBoxEx))    //文本框
             {
                 var textBoxEx = control as TextBoxEx;
                 if (textBoxEx != null) textBoxEx.Caption = String.Empty;
             }
             else if (control.GetType() == typeof(TextChooser)) //选择器
             {
                 var txtChooser = control as TextChooser;
                 if (txtChooser == null) continue;
                 txtChooser.Text = String.Empty;
                 txtChooser.Tag = String.Empty;
             }
             else if (control.GetType() == typeof(ComboBoxEx))   //下拉框
             {
                 var comboBoxEx = control as ComboBoxEx;
                 if (comboBoxEx == null) continue;
                 if (comboBoxEx.Items.Count > 0) comboBoxEx.SelectedIndex = 0;
                 else comboBoxEx.SelectedIndex = -1;
             }
             else if (control.GetType() == typeof(DateTimePickerEx_sms)) //日期选择器
             {
                 var dateTimePicker = control as DateTimePickerEx_sms;
                 if (dateTimePicker != null) dateTimePicker.Value = String.Empty;
             }
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 添加菜单控件
        /// </summary>
        /// <param name="LeftMemuName">菜单名称</param>
        /// <param name="STR_CS_LEFT_MEMU_NAME">fun_id</param>
        /// <param name="childList">二级菜单列表</param>
        /// <param name="next_top">下一个坐标top</param>
        /// <param name="pHeight">二级菜单高度-展开的</param>
        /// <param name="tHeight">菜单列表高度-展开的高度 三级菜单</param>
        /// <param name="SecondMenu">二级菜单DataRow</param>
        private void LeftMenu(string LeftMemuName, string STR_CS_LEFT_MEMU_NAME, DataTable childList, int next_top, int pHeight, int tHeight, DataRow SecondMenu)
        {
            Panel Pleft_panel_tiem = new Panel();       //二级菜单Panel                    
            Pleft_panel_tiem.Name = STR_CS_LEFT_MEMU_NAME;
            Pleft_panel_tiem.BackColor = Color.FromArgb(219, 236, 246);//.White;//.Silver;
            Pleft_panel_tiem.Cursor = Cursors.Default;

            Pleft_panel_tiem.Width = LeftWidth + 3;
            Pleft_panel_tiem.Height = pHeight;
            Pleft_panel_tiem.Location = new Point(0, next_top);                     
            this.Controls.Add(Pleft_panel_tiem);

            PanelEx Pleft_panel_tiem_top = new PanelEx();
            Pleft_panel_tiem_top.Name = "top_" + STR_CS_LEFT_MEMU_NAME;
            Pleft_panel_tiem_top.BackColor = _normalColor;
            Pleft_panel_tiem_top.BorderWidth = 1;
            Pleft_panel_tiem_top.BorderColor = Color.FromArgb(190, 213, 243);
            if (next_top < 0)
            {
                Pleft_panel_tiem_top.Location = new Point(-1, -1);               
            }
            else
            {
                Pleft_panel_tiem_top.Location = new Point(-1, 0);                
            }
            Pleft_panel_tiem_top.Height = item_top_height;
            Pleft_panel_tiem_top.Width = LeftWidth + 3;            
            Pleft_panel_tiem_top.Tag = SecondMenu;
            Pleft_panel_tiem_top.BorderStyle = BorderStyle.FixedSingle;

            if (childList != null && childList.Rows.Count == 0)
            {
                Pleft_panel_tiem_top.Click += new EventHandler(Pleft_panel_tiem_top_Click);
            }
            else
            {
                Pleft_panel_tiem_top.Click += new EventHandler(ibtn_Click);
            }         
            
            Pleft_panel_tiem.Controls.Add(Pleft_panel_tiem_top);


            Label lbl = new Label(); //菜单名称
            lbl.Name = "lbl_" + STR_CS_LEFT_MEMU_NAME;
            lbl.ForeColor = Color.FromArgb(20, 129, 194);
            lbl.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            lbl.Cursor = Cursors.Default;
            lbl.BackColor = Color.Transparent;
            lbl.AutoSize = true;
            lbl.Left = 16;
            lbl.Top = 7;
            lbl.Text = LeftMemuName; //菜单名
            lbl.Tag = SecondMenu;;
            if (childList != null && childList.Rows.Count == 0)
            {
                lbl.Click += new EventHandler(lbl_Click);
            }
            else
            {
                lbl.Click += new EventHandler(ibtn_Click);
            }
            Pleft_panel_tiem_top.Controls.Add(lbl);
           
           
            if (childList != null && childList.Rows.Count == 0)
            {
                //PictureBox pb = new PictureBox();
                //pb.Name = "pb_" + STR_CS_LEFT_MEMU_NAME;
                //pb.Width = 10;
                //pb.Height = 10;
                //pb.Left = LeftWidth - pb.Width - 5;
                //pb.Top = 10;
                //pb.BackColor = Color.Transparent;
                //if (STR_CS_LEFT_MEMU_NAME == str_Curr_Item)
                //{
                //    pb.Image = iChecked;
                //}
                //else
                //{
                //    pb.Image = iNoChecked;
                //}
                //Pleft_panel_tiem_top.Controls.Add(pb);
            }
            else if (childList != null && childList.Rows.Count > 0)
            {
                ServiceStationClient.ComponentUI.ImageButton ibtn = new ImageButton();  //展开折叠
                ibtn.Name = "ibtn_" + STR_CS_LEFT_MEMU_NAME;
                ibtn.Cursor = Cursors.Hand;
                ibtn.Width = 10;
                ibtn.Height = 10;
                ibtn.BackColor = Color.Transparent;
                //ibtn.Left =  LeftWidth - ibtn.Width - 125;
                ibtn.Left = LeftWidth - ibtn.Width - 5;
                ibtn.Top = 10;
                if (STR_CS_LEFT_MEMU_NAME == str_Curr_Item)
                {
                    Pleft_panel_tiem_top.Tag = "1";
                    lbl.Tag = "1";
                    ibtn.Tag = "1";
                    ibtn.BackgroundImage = ServiceStationClient.Skin.Properties.Resources.Menu_Collapse_V;
                }
                else
                {
                    Pleft_panel_tiem_top.Tag = "0";
                    lbl.Tag = "0";
                    ibtn.Tag = "0";
                    ibtn.BackgroundImage = ServiceStationClient.Skin.Properties.Resources.Menu_Expand_V;
                }
                ibtn.Click += new EventHandler(ibtn_Click);
                Pleft_panel_tiem_top.Controls.Add(ibtn);

                TreeViewEx tvex = new TreeViewEx();
                tvex.Name = "tv_" + STR_CS_LEFT_MEMU_NAME;
                tvex.ForeColor = Color.FromArgb(20, 129, 194);
                tvex.Indent = 8;
                tvex.ItemHeight = 25;
                tvex.Location = new Point(0, Pleft_panel_tiem_top.Height);
                tvex.Width = LeftWidth + 3;
                tvex.Height = tHeight;
                tvex.BorderStyle = BorderStyle.None;
                tvex.Scrollable = true;
                tvex.ShowLines = false;
                tvex.Cursor = System.Windows.Forms.Cursors.Hand;
                tvex.ImageList = treeImage;
                Pleft_panel_tiem.Controls.Add(tvex);
                if (childList != null && childList.Rows.Count > 0)
                {
                    foreach (DataRow fun in childList.Rows)
                    {
                        TreeNode node = new TreeNode();

                        node.Tag = fun;
                        node.Text = fun["fun_name"].ToString();
                        node.Name = fun["fun_id"].ToString();
                        if (fun["fun_img"] != DBNull.Value && fun["fun_img"].ToString().Trim() != "")
                        {
                            treeImage.Images.Add(fun["fun_img"].ToString(), ServiceStationClient.Skin.SkinAssistant.GetResourcesImage(fun["fun_img"], true));
                            node.ImageKey = fun["fun_img"].ToString();
                            node.SelectedImageKey = fun["fun_img"].ToString();
                        }
                        tvex.Nodes.Add(node);
                    }
                }
                tvex.ItemDrag += new ItemDragEventHandler(tvex_ItemDrag);
                tvex.NodeMouseClick += new TreeNodeMouseClickEventHandler(tvex_NodeMouseClick);
            }
        }
Exemplo n.º 4
0
            /// <summary>添加菜单控件
            /// </summary>
            /// <param name="LeftMemuName">菜单名称</param>
            /// <param name="STR_CS_LEFT_MEMU_NAME">fun_id</param>
            /// <param name="childList">二级菜单列表</param>
            /// <param name="next_top">下一个坐标top</param>
            /// <param name="pHeight">二级菜单高度-展开的</param>
            /// <param name="tHeight">菜单列表高度-展开的高度 三级菜单</param>
            /// <param name="SecondMenu">二级菜单DataRow</param>
            private void LeftMenu(string LeftMemuName, string STR_CS_LEFT_MEMU_NAME, DataTable childList, int next_top, int pHeight, int tHeight, DataRow SecondMenu)
            {

                PanelEx Pleft_panel_tiem = new PanelEx();       //二级菜单Panel                    
                Pleft_panel_tiem.Name = STR_CS_LEFT_MEMU_NAME;
                Pleft_panel_tiem.BackColor = Color.FromArgb(219, 236, 246);//.White;//.Silver;
                //Pleft_panel_tiem.Location = new Point(0, 0);
                Pleft_panel_tiem.Width = LeftWidth;
                Pleft_panel_tiem.Height = pHeight;
                Pleft_panel_tiem.BorderStyle = BorderStyle.FixedSingle;
                Pleft_panel_tiem.BorderWidth = 0;
                Pleft_panel_tiem.Top = next_top;

                Pleft_panel_tiem.Left = 0;
                //plecd.Anchor = AnchorStyles.Left;
                this.Controls.Add(Pleft_panel_tiem);

                PanelEx Pleft_panel_tiem_top = new PanelEx();
                Pleft_panel_tiem_top.Name = "top_" + STR_CS_LEFT_MEMU_NAME;
                Pleft_panel_tiem_top.BackColor = Color.FromArgb(233, 243, 253);// Color.LightSkyBlue;
                Pleft_panel_tiem_top.BorderWidth = 1;
                Pleft_panel_tiem_top.BorderColor = Color.FromArgb(190, 213, 243);
                Pleft_panel_tiem_top.Location = new Point(0, 0);
                Pleft_panel_tiem_top.Width = LeftWidth;
                Pleft_panel_tiem_top.Height = item_top_height;
                Pleft_panel_tiem_top.Tag = SecondMenu;
                Pleft_panel_tiem_top.BorderStyle = BorderStyle.FixedSingle;
                if (childList != null && childList.Rows.Count == 0)
                {
                    Pleft_panel_tiem_top.Click += new EventHandler(Pleft_panel_tiem_top_Click);
                }
                Pleft_panel_tiem.Controls.Add(Pleft_panel_tiem_top);

                var image = new PictureBox();
                image.Location = new Point(4,6);
                image.Image = SkinAssistant.GetResourcesImage(STR_CS_LEFT_MEMU_NAME, true);
                image.SizeMode = PictureBoxSizeMode.AutoSize;
                Pleft_panel_tiem_top.Controls.Add(image);

                Label lbl = new Label(); //菜单名称
                lbl.Name = "lbl_" + STR_CS_LEFT_MEMU_NAME;
                lbl.ForeColor = Color.FromArgb(20, 129, 194);
                lbl.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                lbl.Cursor = Cursors.Default;
                lbl.BackColor = Color.Transparent;
                lbl.AutoSize = true;
                lbl.Left = 16;
                lbl.Top = 6;
                lbl.Text = LeftMemuName; //菜单名
                lbl.Tag = SecondMenu; ;
                if (childList != null && childList.Rows.Count == 0)
                {
                    lbl.Click += new EventHandler(lbl_Click);
                }
                Pleft_panel_tiem_top.Controls.Add(lbl);



                if (childList != null && childList.Rows.Count == 0)
                {
                    PictureBox pb = new PictureBox();
                    pb.Name = "pb_" + STR_CS_LEFT_MEMU_NAME;
                    pb.Width = 24;
                    pb.Height = 24;
                    pb.Left = LeftWidth - pb.Width - 2;
                    pb.Top = 3;
                    if (STR_CS_LEFT_MEMU_NAME == str_Curr_Item)
                    {
                        pb.Image = null;
                    }
                    else
                    {
                        pb.Image = null;
                    }
                    Pleft_panel_tiem_top.Controls.Add(pb);
                }
                else if (childList != null && childList.Rows.Count > 0)
                {
                    ServiceStationClient.ComponentUI.ImageButton ibtn = new ImageButton();  //展开折叠
                    ibtn.Name = "ibtn_" + STR_CS_LEFT_MEMU_NAME;
                    ibtn.Cursor = Cursors.Hand;
                    ibtn.Width = 24;
                    ibtn.Height = 24;
                    ibtn.Left = LeftWidth - ibtn.Width - 2;
                    ibtn.Top = 3;
                    if (STR_CS_LEFT_MEMU_NAME == str_Curr_Item)
                    {
                        ibtn.Tag = "1";
                        ibtn.BackgroundImage = ServiceStationClient.Skin.Properties.Resources.ico_delete;
                    }
                    else
                    {
                        ibtn.Tag = "0";
                        ibtn.BackgroundImage = ServiceStationClient.Skin.Properties.Resources.ico_add;
                    }
                    ibtn.Click += new EventHandler(ibtn_Click);
                    Pleft_panel_tiem_top.Controls.Add(ibtn);

                    TreeViewEx tvex = new TreeViewEx();
                    tvex.Name = "tv_" + STR_CS_LEFT_MEMU_NAME;
                    tvex.ForeColor = Color.FromArgb(20, 129, 194);
                    tvex.Indent = 8;
                    tvex.ItemHeight = 21;
                    tvex.Location = new Point(0, Pleft_panel_tiem_top.Height);
                    tvex.Width = LeftWidth;
                    tvex.Height = tHeight;
                    tvex.BorderStyle = BorderStyle.None;
                    tvex.Scrollable = true;
                    tvex.ShowLines = false;
                    tvex.Cursor = System.Windows.Forms.Cursors.Hand;
                    tvex.ImageList = treeImage;
                    Pleft_panel_tiem.Controls.Add(tvex);
                    if (childList != null && childList.Rows.Count > 0)
                    {
                        #region modify by kord
                        //foreach (DataRow fun in childList.Rows)
                        //{
                        //    TreeNode node = new TreeNode();
                        //    node.Tag = fun;
                        //    node.Text = fun["fun_name"].ToString();
                        //    node.Name = fun["fun_id"].ToString();
                        //    if (fun["fun_img"] != DBNull.Value && fun["fun_img"].ToString().Trim() != "")
                        //    {
                        //        treeImage.Images.Add(fun["fun_img"].ToString(), (Image)ServiceStationClient.Skin.Properties.Resources.ResourceManager.GetObject(fun["fun_img"].ToString()));
                        //        node.ImageKey = fun["fun_img"].ToString();
                        //        node.SelectedImageKey = fun["fun_img"].ToString();
                        //    }
                        //    tvex.Nodes.Add(node);
                        //}

                        foreach (DataRow fun in childList.Rows)
                        {
                            TreeNode node = new TreeNode();

                            node.Tag = fun;
                            node.Text = fun["fun_name"].ToString();
                            node.Name = fun["fun_id"].ToString();
                            if (fun["fun_img"] != DBNull.Value && fun["fun_img"].ToString().Trim() != "")
                            {
                                treeImage.Images.Add(fun["fun_img"].ToString(), ServiceStationClient.Skin.SkinAssistant.GetResourcesImage(fun["fun_img"], true));
                                node.ImageKey = fun["fun_img"].ToString();
                                node.SelectedImageKey = fun["fun_img"].ToString();
                            }
                            tvex.Nodes.Add(node);
                        }
                        #endregion
                    }
                    //tvex.ItemDrag += new ItemDragEventHandler(tvex_ItemDrag);
                    tvex.NodeMouseClick += new TreeNodeMouseClickEventHandler(tvex_NodeMouseClick);
                }
            }