友情链接1:21点 足球投注 投注网 明升体育 hg0088 葡京赌场 网上赌球 诈金花 澳门金沙网址 澳门银河网址 澳门银河 澳门银河官网 银河官网 威尼斯人 澳门威尼斯人 澳门威尼斯人官网 威尼斯人官网 金沙 澳门金沙 澳门金沙官网 金沙官网 现金网 赌球网 全讯网 明升国际 足球开户 ******官网 ******网址 现金赌博 澳门现金网 ******官方网站

DevExpress鎺т欢涔婲avBarControl鐏垫椿浣跨敤 « Carey's Blog - 寤栧媷鐨勫崥瀹

DevExpress鎺т欢涔婲avBarControl鐏垫椿浣跨敤

鏃堕棿锛2013骞04鏈26鏃浣滆咃細Carey闃呰(15,129)璇勮(2)

鏈枃涓昏灞曠ずCarey鍦–/S缁撴瀯涓嬩娇鐢―evExpress鎺т欢瀵规潈闄愮殑鎺у埗鍙婂鐞嗘柟娉.鍔熻兘瀵艰埅鑿滃崟浣跨敤鐨勬槸NavBarControl.姝ょ鍋氭硶鎼缓涓娆,浠ュ悗涓皬鍨嬮」鐩嵆鍙噸澶嶄娇鐢,涓斿鏉冮檺鐨勬帶鍒,鏇存敼,涓氬姟闇姹傚彉鏇寸瓑閮藉叿鏈夎緝寮虹殑鐏垫椿鎬.

PS:Q缇#DevExpress鎶鏈氦娴 缇ゅ彿:160257101 娆㈣繋鍚勪綅DevExpress鐢ㄦ埛杩涚兢瀛︿範涓庝氦娴.

鍦ㄦ潈闄愭帶鍒舵柟闈㈠簲鐢ㄦ瘮杈冪畝鍗曚笖娴佽鐨勪簲琛ㄦ潈闄愮粨鏋,鍗砤,鐢ㄦ埛琛(_sysEmployee)b,瑙掕壊琛(_sysRoles)c,鍔熻兘琛(_systemFunction),d鐢ㄦ埛瀵硅鑹茶〃(_sysUser_Role),e瑙掕壊瀵瑰姛鑳借〃(_sysRole_Popedom),鍏崇郴鍥惧涓.

聽 鍦ㄤ娇鐢∟avBarControl鍔ㄦ佺敓鎴愬鑸彍鍗曟椂浣跨敤鐨勫叧閿〃涓哄姛鑳借〃(_systemFunction),姝よ〃瀛楁璇存槑濡備笅:

绋嬪簭鍏抽敭浠g爜濡備笅:

	/// <summary>
	/// 鍔犺浇瀵艰埅鑿滃崟
	/// </summary>
	/// <returns>鎴愬姛/澶辫触</returns>
	private boolSystemFunctionLoad()
	{
	    DataTabledat=new DataTable();
	    if (AccountInfo._Us_Role==1)
	    {
	        //濡傛灉涓虹鐞嗗憳
	        dat = SystemManage.GetAllSystemFunction();//鏌ヨ鎵鏈夊姛鑳借彍鍗
	    }
	    else
	    {
	        dat = SystemManage.GetAllSystemFunction(AccountInfo._Us_Role);//鏍规嵁瑙掕壊ID鏌ヨ鐩稿叧鍔熻兘鏁版嵁闆嗗悎
	    }
	    if (dat != null &&dat.Rows.Count> 0)
	    {
	        NavBarGroupnbg = null;
	        NavBarItem item = null;
	        for (int i = 0; i <dat.Rows.Count; i++)
	        {
	            if (dat.Rows[i]["levels"].ToString() == "0")
	            {
	                //鐖剁骇鑿滃崟
	                nbg = new NavBarGroup();
	                nbg.Caption = dat.Rows[i]["funcName"].ToString();
	                navBarControl1.Groups.Add(nbg);
	            }
	            else
	            {
	                //瀛愮骇鑿滃崟
	                item = new NavBarItem();
	                item.Caption = dat.Rows[i]["funcName"].ToString();//鑿滃崟鍚嶇О
	                item.Name = dat.Rows[i]["formName"].ToString();//绐椾綋璺緞
	                item.Hint = dat.Rows[i]["showType"].ToString();//鎵撳紑妯″紡
	                item.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(Item_Click);//璧嬩簣鍗曞嚮浜嬩欢
	                nbg.ItemLinks.Add(item);
	            }
	        }
	        return true;
	    }
	    else
	        return false;
	}

鑿滃崟鍗曞嚮浜嬩欢:

	/// <summary>
	/// 鑿滃崟鍗曞嚮浜嬩欢
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void Item_Click(object sender, EventArgs e)
	{
	    NavBarItemsd = sender as NavBarItem;
	    if (sd.Name.Contains("."))//鏍规嵁琛⊿ystemFunction-瀛楁formName纭畾鏄惁鐐瑰嚮鐨勪负鍔熻兘鑿滃崟
	    {
	        try
	        {
	            groupControl1.Visible = false;
	            System.Reflection.AssemblytempAssembly = System.Reflection.Assembly.GetExecutingAssembly();//鑾峰彇鍖呭惈褰撳墠鎵ц鐨勪唬鐮佺殑绋嬪簭闆
	            XtraFormfm = (XtraForm)(tempAssembly.CreateInstance(sd.Name)); //鍙嶅皠鏈哄埗鎵惧埌鎸囧畾鍚嶇О鐨勭被鍨嬪苟浣跨敤绯荤粺婵娲诲櫒鍒涘缓瀹冪殑瀹炰緥
	            if (fm != null)
	            {
	                fm.AccessibleName = sd.Hint;
	                fm.Text = sd.Caption;
	                CreateChildForm(fm);//鎵撳紑绐椾綋
	            }
	            else
	            {
	                XtraMessageBox.Show("绐楀彛鏁版嵁閰嶇疆閿欒,璇疯仈绯荤郴缁熺鐞嗗憳锛", "绯荤粺鎻愮ず", MessageBoxButtons.OK, MessageBoxIcon.Information);
	            }
	        }
	        catch (Exception)
	        {
	        }
	    }
	}

鎵撳紑绐椾綋鐢ㄥ埌鐨勬槸xtraTabbedMdiManager鎺т欢,璇ョ┖闂村厑璁稿悓鏃舵墦寮澶氫釜瀛愮獥浣,浣犻渶瑕佸仛鐨勫氨鏄嫋涓婁竴涓鎺т欢鍒拌璁$獥浣,鐒跺悗鍦ㄧ獥浣撳姞杞戒簨浠朵腑鍔犲叆xtraTabbedMdiManager1.MdiParent = this;鍗冲彲.

	/// <summary>

	        /// 鎵撳紑绐椾綋 

	        /// </summary>

	        /// <param name="ChildForm"></param>

	        /// <returns></returns>

	        public static Form CreateChildForm(XtraFormChildForm) 

	        { 

	            foreach (Form frm in mf.MdiChildren) 

	            { 

	                if (ChildForm.Text == frm.Text) 

                { 

	                    ChildForm.Close(); 

	                    ChildForm.Dispose(); 

	                    frm.Activate(); 

	                    return frm; 

	                } 

            } 

	            if (ChildForm.AccessibleName == "Show") 

	            { 

	                ChildForm.MdiParent = mf; 

	                ChildForm.Show(); 

	            } 

	            else

	            { 

	                ChildForm.MaximizeBox = false;//绂佺敤鏈澶у寲             

	                ChildForm.ShowIcon = false;//绂佺敤鍥炬爣 

                ChildForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;//绐椾綋杈规鏍峰紡 

	                ChildForm.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;//绐椾綋鍦ㄤ腑闂翠綅缃墦寮 

	                ChildForm.ShowInTaskbar = false;//涓嶅湪浠诲姟鏍忔樉绀 

	                ChildForm.ShowDialog();//浠ユā寮忕獥浣撴墦寮 

            } 

	            return ChildForm; 

	        }

鏈鍚庡啀闄勫姞涓娈靛姛鑳藉寮轰唬鐮,瀹炵幇褰撳悓鏃舵墦寮澶氫釜瀛愮獥浣撴椂鍙屽嚮page鏍囩鍏抽棴绐椾綋鐨勬晥鏋.

	private void xtraTabbedMdiManager1_MouseDown(object sender, MouseEventArgs e)
	        {
            if (e.Button == MouseButtons.Left)
            {
	                DateTimedt = DateTime.Now;
	                TimeSpan span = dt.Subtract(m_LastClick);
	                if (span.TotalMilliseconds< 300)  //濡傛灉涓ゆ鐐瑰嚮鐨勬椂闂撮棿闅斿皬浜300姣锛屽垯璁や负鏄弻鍑
	                {
	                    if (this.MdiChildren.Length> 1)
	                    {
                        this.ActiveMdiChild.Close();
                   }
	                    m_LastClick = dt.AddMinutes(-1);
	                }
	                else
	                    m_LastClick = dt;
	            }
	        }

鍙﹀鐨勫叕鍏辫彍鍗曡濡備慨鏀瑰瘑鐮,閫鍑虹郴缁,鏇存崲鐨偆绛夊姛鑳藉彲浠ョ敤浠g爜鐩存帴鍒涘缓,涔熷彲鍦ㄨ璁$晫闈㈠垱寤.

澹版槑: 鏈枃閲囩敤 BY-NC-SA 鍗忚杩涜鎺堟潈 | Carey's Blog
杞浇璇锋敞鏄庤浆鑷DevExpress鎺т欢涔婲avBarControl鐏垫椿浣跨敤

0鏉¤瘎璁
    姝ゆ棩蹇楀凡鍏抽棴璇勮锛