C++ 在c+中创建窗口+;使用Winbgim
我想在主监视器中创建一个全屏窗口。我已经这样做了,但是窗口从坐标3x0开始,而不是0x0。我应该如何更正我的代码 这是我的密码:C++ 在c+中创建窗口+;使用Winbgim,c++,graphics,window,resolution,monitor,C++,Graphics,Window,Resolution,Monitor,我想在主监视器中创建一个全屏窗口。我已经这样做了,但是窗口从坐标3x0开始,而不是0x0。我应该如何更正我的代码 这是我的密码: #include <graphics.h> int main() { int hor=GetSystemMetrics(SM_CXSCREEN); int ver=GetSystemMetrics(SM_CYSCREEN); initwindow(hor, ver, "Convex Hull", 0, 0); getch(); close
#include <graphics.h>
int main()
{
int hor=GetSystemMetrics(SM_CXSCREEN);
int ver=GetSystemMetrics(SM_CYSCREEN);
initwindow(hor, ver, "Convex Hull", 0, 0);
getch();
closegraph();
return( 0 );
}
#包括
int main()
{
int hor=GetSystemMetrics(SM_CXSCREEN);
int ver=GetSystemMetrics(SM_CYSCREEN);
初始窗口(hor,ver,“凸包”,0,0);
getch();
closegraph();
返回(0);
}
另外,我将WinBGIm图形库与CodeBlocks EP IDE环境一起使用
提前感谢让我们看一下函数:
int initwindow(int width, int height, const char* title="Windows BGI", int left=0, int top=0)
您所要做的就是将其设置为顶部和左侧,以使其适合您的屏幕,在我的情况下是这样的:
initwindow(1920,1009, "Window",-8,-1);
让我们看看函数:
int initwindow(int width, int height, const char* title="Windows BGI", int left=0, int top=0)
您所要做的就是将其设置为顶部和左侧,以使其适合您的屏幕,在我的情况下是这样的:
initwindow(1920,1009, "Window",-8,-1);
如何确定窗口的实际位置?我认为屏幕的点(最左边、最上面)对应于我不熟悉的点(0,0),但如果它允许您访问Windows API级别的“窗口句柄”,那么您可以使用调用API函数,如MoveWindow和SetWindowPos(我记得后者功能更强大,但请查看)。如何确定窗口的实际位置?我认为屏幕的点(最左侧、最顶部)对应于我不熟悉的点(0,0),但如果它允许您访问Windows API级别的“窗口句柄”,然后您可以使用调用API函数,如MoveWindow和SetWindowPos(我记得后者更强大,但请查看它们)。