在菜單欄布局上,為了使用自定義窗體樣式和按鈕,我們需要先將窗體設置為無邊框,然后添加一個Grid作為菜單欄並置頂,VerticalAlignment="Top"
logo圖片和標題是Image和TextBlock控件,菜單是Menu控件,系統按鈕是Button控件。
其中需要注意的是,一般醫院影像科或放射科閱片采用的是雙屏,橫屏+豎屏,而PACS一般是在豎屏上顯示,
當最大化窗體時,如果不進行特殊處理,則會在橫屏上最大化,而我們的要求是在豎屏上最大化,
所以需要監聽最大化按鈕的點擊事件,並指定在豎屏上最大化,
關鍵代碼:
/// <summary>
/// 重新計算工作屏幕對象 /// </summary>
/// <returns></returns>
public static System.Windows.Forms.Screen ReSetScreen() { System.Windows.Interop.WindowInteropHelper windowInteropHelper = new System.Windows.Interop.WindowInteropHelper(this); System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.FromHandle(windowInteropHelper.Handle); return screen; }
//在指定屏幕重新設置窗體大小和位置
var screen =ReSetScreen(); Height = screen.WorkingArea.Height; Width = screen.WorkingArea.Width; Top = screen.Bounds.Top; Left = screen.Bounds.Left;