【声明】优快云只做转发不做时时更新,最新博客请关注博客园C# 系统菜单弹出框方向 - 唐宋元明清2188 - 博客园
右键菜单,tootip等弹出时,弹出的位置经常在左侧,使用体验不好。
弹出方向有左对齐和右对齐 SystemParameters.MenuDropAlignment
当右对齐时,值为false
可以在控制面板中查看当前的设置:
如何在软件中强制向右弹出显示?
可以设置SystemParameters.MenuDropAlignment值,因为没有公开属性的set方法,只能用反射去修改了。
1 public static class MenuDropAlignmentHelper 2 { 3 private static FieldInfo _menuDropAlignmentField; 4 public static void DisableSystemMenuAlignment() 5 { 6 _menuDropAlignmentField = typeof(SystemParameters).GetField("_menuDropAlignment", BindingFlags.NonPublic | BindingFlag