【问题标题】:creating a window in c++ using Winbgim使用 Winbgim 在 C++ 中创建一个窗口
【发布时间】:2016-05-08 11:24:15
【问题描述】:

我想在主监视器中创建一个全屏窗口。我已经完成了,但窗口从坐标 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();
 closegraph();
 return( 0 );
 }

附:我在 CodeBlocks-EP IDE 环境中使用 WinBGIm 图形库

提前致谢

【问题讨论】:

  • 如何确定窗口的实际位置?
  • 我认为屏幕的点(最左,最上)对应点(0,0)
  • 我不熟悉该框架,但如果它让您可以访问 Windows API 级别的“窗口句柄”,那么您可以使用该调用 API 函数,例如 MoveWindow 和 SetWindowPos(我记得后者更强大,但请检查一下)。

标签: c++ graphics window resolution monitor


【解决方案1】:

我们来看看函数:

int initwindow(int width, int height, const char* title="Windows BGI", int left=0, int top=0)

您所要做的就是设置顶部和左侧,使其适合您的屏幕,在我的情况下是这样的:

initwindow(1920,1009, "Window",-8,-1);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-08
    • 1970-01-01
    • 1970-01-01
    • 2022-11-02
    • 2022-01-25
    • 1970-01-01
    相关资源
    最近更新 更多