久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Winforms 中禁用的菜單項仍顯示子項

Disabled menu items in Winforms still show subitems(Winforms 中禁用的菜單項仍顯示子項)
本文介紹了Winforms 中禁用的菜單項仍顯示子項的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

如果我創建一個包含兩個項目的菜單(比如Item1"和Item2",然后在每個項目下創建兩個子項目(1A、1B、2A 和 2B),然后禁用 Item1,我希望 1A 和1B 不會顯示.

If I create a menu with two items (say "Item1" and "Item2" and then create two subitems under each one (1A, 1B, 2A and 2B), and then disable Item1, I'd expect that 1A and 1B wouldn't show.

而且,事實上,如果我轉到 Item1,他們就不會.除非我接著移至 Item2,等待 2A 和 2B 顯示,然后移回 Item1.此時 1A 和 1B 都彈出,完全激活.

And, indeed, if I move onto Item1 they don't. Unless I then move on to Item2, wait for 2A and 2B to show, and then move back to Item1. At which point 1A and 1B both pop up, fully active.

這是一個已知的錯誤嗎?這是我可以解決的問題嗎?有什么建議嗎?

Is this a known bug? Is it something I can work around? Any suggestions?

用戶希望能夠看到當前被禁用的東西,或者我只是讓東西不可見.遺憾的是,這不是我們可以輕松使用的選項.

The users want to be able to see the things that are currently disabled, or I'd just make things invisible. Sadly, this isn't an option we can easily use.

推薦答案

我可以確認在 MenuStrip for Framework 2.0、3.5 和 4.0 中會發生這種情況.我唯一合理的解決方法是將 Visible 屬性設置為 false,因此該項目根本不會出現.不理想,但比讓子項目可訪問要好.

I can confirm that this occurs with the MenuStrip for Framework 2.0, 3.5 and 4.0. The only reasonable workaround that I have is to set the Visible property to false, so the item does not appear at all. Not Ideal, but better than having the sub-items accessible.

當然你也可以創建一個函數來遞歸禁用所有子項,這樣即使出現了,也至少是禁用的,你需要保持之前的狀態,以確保以后不會重新啟用一個實際上打算被禁用的子項目等.文檔表明這實際上是發生了什么,但事實并非如此,即使父項目被禁用,子項目仍然保持啟用狀態.

Of course you can also create a function that will recursively disable all child items, that way even if they appear, they are at least disabled, you will need to maintain the previous state to ensure that you do not later re-enable a child item that is actually inteded to be disabled etc. The documentation indicates that this is actually what happens, but that is not the case, sub-items remain enabled even when the parent item is disabled.

這篇關于Winforms 中禁用的菜單項仍顯示子項的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

LINQ to SQL and Concurrency Issues(LINQ to SQL 和并發問題)
Yield return from a try/catch block(try/catch 塊的收益回報)
Should I call Parameters.Clear when reusing a SqlCommand with a transation?(重用帶有事務的 SqlCommand 時,我應該調用 Parameters.Clear 嗎?)
what does a using statement without variable do when disposing?(處理時不帶變量的 using 語句有什么作用?)
Why doesn#39;t TransactionScope work with Entity Framework?(為什么 TransactionScope 不適用于實體框架?)
How to dispose TransactionScope in cancelable async/await?(如何在可取消的 async/await 中處理 TransactionScope?)
主站蜘蛛池模板: 国产激情在线 | 欧美精品91| 黄色毛片一级 | 午夜tv免费观看 | 午夜资源| 欧美激情久久久 | 黄色大片在线视频 | 欧美一区二区三区四区五区无卡码 | 天天天天操 | 中文字幕视频在线观看 | 一级毛片在线看 | 97精品国产 | 在线一区二区三区 | 亚洲视频一区在线观看 | 国产精品一区二区av | 欧美一区二区三区 | 久久精品99 | 成人中文字幕在线观看 | 在线免费观看黄a | 欧美日韩一区在线观看 | 久草青青草 | 一二三区在线 | av一区二区在线观看 | 亚洲欧美日韩精品久久亚洲区 | 欧美精品一区二区三区蜜臀 | 欧美在线一区二区视频 | 久久精品日 | 欧美在线视频一区 | 欧美成人精品一区二区男人看 | 色综合天天网 | 天天插天天操 | 久久久久久久久久久国产 | 成人一区二区三区 | 五月婷婷亚洲 | 亚洲精品综合 | 麻豆91av | 成人影院av| 亚洲综合无码一区二区 | 在线欧美亚洲 | 午夜免费看 | 国产一区二区在线播放 |