Exemplo n.º 1
0
        private void UCLeftMenu_Load(object sender, EventArgs e)
        {
            //lblMemuName.Text = menuName;
            DataTable dtFirstChilds = new DataTable();    //第一个二级菜单下的子菜单
            DataTable dt            = CommonCtrl.getDataChildsByPid(FunID);

            if (dt != null && dt.Rows.Count > 0)    //result.Count() > 0)
            {
                int next_top                = 0;
                int Pleft_panelHeight       = panel_MainHeight;                                                            //panel的高度
                int Pleft_panel_count       = dt.Rows.Count;                                                               //二级菜单个数
                int Pleft_panel_item_height = Pleft_panelHeight - (Pleft_panel_count * item_top_height) + item_top_height; //二级菜单高度-展开的
                int tvex_height             = Pleft_panel_item_height - item_top_height;                                   //菜单列表高度-展开的高度 三级菜单

                str_Curr_Item = dt.Rows[0]["fun_id"].ToString();                                                           // result[0].fun_id;
                int i       = 0;
                int pHeight = Pleft_panel_item_height;
                int tHeight = tvex_height;

                foreach (DataRow fun in dt.Rows)
                {
                    DataTable dtChilds = CommonCtrl.getDataChildsByPid(fun["fun_id"].ToString());
                    LeftMenu(fun["fun_name"].ToString(), fun["fun_id"].ToString(), dtChilds, next_top, pHeight, tHeight, fun);
                    if (i == 0)
                    {
                        dtFirstChilds = dtChilds;
                        pHeight       = item_top_height;
                        tHeight       = 0;
                        next_top     += Pleft_panel_item_height;
                    }
                    else
                    {
                        next_top += item_top_height;
                    }
                    i++;
                }
            }
            if (IsLoad && dtFirstChilds.Rows.Count == 0)
            {
                str_Curr_Item = "";
            }
            LeftMenuState(str_Curr_Item, "");
            IsLoad = false;
        }