Statement posted, too much is not all of these are the online code
The code below
Public enum appStyle {
FullScreen=0,
WindowedFullScreen=1,
Windowed=2,
WindowedWithoutBorder=3,
}
Public appStyle AppWindowStyle=appStyle. WindowedFullScreen;
Public enum zDepth {
Normal=0,
Top=1,
TopMost=2,
}
Public zDepth ScreenDepth=zDepth. Normal;
Public int windowLeft=10;
Public int windowTop=10;
Public int windowWidth=800;
Public int windowHeight=600;
Const uint SWP_NOMOVE=0 x0002;
Const uint SWP_FRAMECHANGED=0 x0020;
Const uint SWP_SHOWWINDOW=0 x0040;
Const int GWL_STYLE=- 16;
Const int WS_BORDER=1;
Private the Rect screenPosition;
Private const int GWL_EXSTYLE=(20);
Private const int WS_CAPTION=0 xc00000;
Private const int WS_POPUP=0 x800000;
IntPtr HWND_TOP=new IntPtr (0);
IntPtr HWND_TOPMOST=new IntPtr (1);
IntPtr HWND_NORMAL=new IntPtr (2);
Private const int SM_CXSCREEN=0 x00000000;
Private const int SM_CYSCREEN=0 x00000001;
Int Xscreen;
Int Yscreen;
Void the Start ()
{
Xscreen=(int) GetSystemMetrics (SM_CXSCREEN);
Yscreen=(int) GetSystemMetrics (SM_CYSCREEN);
//this is
If ((int) AppWindowStyle==1)
{
Screen. SetResolution (Yscreen Xscreen - 1, 60, false);
Xscreen screenPosition=new the Rect (0, 0, 1, Yscreen - 1);
}
}
int i=0;
Void the Update () {
//then I don't understand why want to set up in the Update, directly at the Start setting is bad?
//I found many parameters can change the position of the window, and my goal is in single and double screen is full screen window on the first screen
If (I & lt; 5)
{
If ((int) AppWindowStyle==1)
{
If ((int) ScreenDepth==2)
HWND_TOPMOST SetWindowPos (GetForegroundWindow (), (int) screenPosition. X, (int) screenPosition. Y, (int) screenPosition. Width, (int) screenPosition. Height, SWP_SHOWWINDOW);
ShowWindow (GetForegroundWindow (), 3);
}
}
i++;
}
CodePudding user response:
Has been in double screen, haven't met this kind of circumstance, you build a project, don't try to write a single line of code,Really can't judge a full-screen, set up the self. Left=0
CodePudding user response:
Not met, please check your window is maximized, and specifies the size, in addition to pay attention to a Form of property: the Position, the duty is poDesktopCenter, and the window is not to maximize will appear this kind of situation, youPoScreenCenter: in the middle of the a monitor
PoDesktopCenter: in the middle of the multiple display of large desktop