2014-03-25 43 views
0

我在我的Windows窗體應用程序包含MenuItems.Now中有一個MenuStrip按照我的要求,我必須檢查一些條件並啓用/禁用菜單項中MenuItems的可見性但我不知道如何去做。 假設普通用戶正在訪問應用程序,那麼一些MenuItems將被隱藏,並且如果Admin用戶正在訪問該應用程序,則所有MenuItems都應該可見。如何從Windows窗體應用程序中的MenuStrip隱藏特定菜單項

請幫助我。提前感謝。

+0

'。可見= FALSE'

if (UserIsAdmin) // User is admin so he can see the menu item menu.Visible = true; else // user is not admin, so he can not see the menu item menu.Visible = false; 

UserIsAdminbool變量 – bansi

回答

2

可以設置Visible爲假:這是由你的代碼返回給用戶指示水平

相關問題