C 設定窗體最大化 最小化 頂端顯示

2021-06-08 20:16:09 字數 856 閱讀 9406

設定全屏:

this.formborderstyle = formborderstyle.none;

this.windowstate = formwindowstate.maximized;

this.topmost = true;      //這個一定要設定,不然一般會出現bug

取消全屏,正常化:

this.formborderstyle = formborderstyle.sizable;

this.windowstate = formwindowstate.normal;

最小化:

this.formborderstyle = formborderstyle.sizable;

this.windowstate = formwindowstate.minimized;

獲取螢幕尺寸:

int screenheight = system.windows.forms.screen.primaryscreen.bounds.height;  //顯示器高度

int screenwidth = system.windows.forms.screen.primaryscreen.bounds.width;    //顯示器寬度

設定窗體居中最頂端顯示 

this.setbounds((system.windows.forms.screen.primaryscreen.bounds.width - this.width) / 2, 0, this.width, this.height);

如再要使得某個控制項全屏,如globecontril、mapcontrol,只需要將他們的top、left、width、height等屬性

設定為螢幕大小即可。

C 設定窗體最大化 最小化 頂端顯示

設定全屏 this.formborderstyle formborderstyle.none this.windowstate formwindowstate.maximized this.topmost true 這個一定要設定,不然一般會出現bug 取消全屏,正常化 this.formborde...

窗體 最大化 最小化 關閉按鈕

qt 設定透明按鈕 沒試驗 qpushbutton bt new qpushbutton this bt settext ok bt move 200,100 bt setflat true 就是這句能夠實現透明,視窗置頂 this setwindowflags qt windowstaysonto...

c 最大化最小化事件

const int wm syscommand 0x112 const int sc close 0xf060 const int sc minimize 0xf020 const int sc maximize 0xf030 protected override void wndproc ref ...