دنبال کننده ها

۱۳۹۶ بهمن ۱۱, چهارشنبه

winforms - Any way to get the width of a Context Menu before it is displayed?

[ad_1]



I want to know the what the width of the context menu will be, just before being displayed, possibly in the myContextMenu.popup event handler or better yet, before myContextMenu.show().



The reason I want to know the width, is so that I can affect the location of where it will be painted. Specifically, in the circumstance where the data of a column is right justified, when the operator right clicks, I don't want the context menu to cover the data, which is typically, also to the right. If I have the width, I can move the context menu to the left by the amount of the width and the top-right corner of the context menu will be at the point of the cursor.



I really do not want to use the myContextMenu.DrawItem event to paint the context menu items unless that is absolutely the only way to accomplish this.




[ad_2]

لینک منبع