求一段 E 文翻译

unhappyless 2009-02-19 03:21:10
SetConsoleWindowInfo

The SetConsoleWindowInfo function sets the current size and position of a console screen buffer's window.


BOOL SetConsoleWindowInfo(
HANDLE hConsoleOutput,
BOOL bAbsolute,
const SMALL_RECT* lpConsoleWindow
);


bAbsolute
[in] If this parameter is TRUE, the coordinates specify the new upper-left and lower-right corners of the window. If it is FALSE, the coordinates are offsets to the current window-corner coordinates.

求上面参数为 false 的翻译?代码试验结果没发现窗体有变化



#include <windows.h>
#include <stdio.h>
#include <conio.h>
void main()
{
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
// 获取标准输出设备句柄
CONSOLE_SCREEN_BUFFER_INFO bInfo; // 窗口缓冲区信息

SMALL_RECT rc = {0,0, 80-50, 25-22}; // 重置窗口位置和大小
GetConsoleScreenBufferInfo(hOut, &bInfo );
_getch();
SetConsoleWindowInfo(hOut,false ,&rc);
GetConsoleScreenBufferInfo(hOut, &bInfo );
_getch();
CloseHandle(hOut); // 关闭标准输出设备句柄
}

...全文
177 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
wenhongang 2012-09-20
  • 打赏
  • 举报
回复
	
COORD consoleCoord=GetLargestConsoleWindowSize(hConsole);

SetConsoleScreenBufferSize(hConsole,consoleCoord);

SMALL_RECT rc = {0,0,consoleCoord.X-1,consoleCoord.Y-1};

SetConsoleWindowInfo(hConsole,TRUE,&rc);
wenhongang 2012-09-20
  • 打赏
  • 举报
回复

#include
#include
#include
void main()
{
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
// 获取标准输出设备句柄
CONSOLE_SCREEN_BUFFER_INFO bInfo; // 窗口缓冲区信息
GetConsoleScreenBufferInfo(hOut, bInfo );
// 获取窗口缓冲区信息
char strTitle[255];
GetConsoleTitle(strTitle, 255); // 获取窗口标题
printf("当前窗口标题是:%s\n", strTitle);
_getch();
SetConsoleTitle("控制台窗口操作"); // 获取窗口标题
_getch();
COORD size = {80, 25};
SetConsoleScreenBufferSize(hOut,size); // 重新设置缓冲区大小
_getch();
SMALL_RECT rc = {0,0, 80-1, 25-1}; // 重置窗口位置和大小
SetConsoleWindowInfo(hOut,true ,&rc);
CloseHandle(hOut); // 关闭标准输出设备句柄
}

//需要说明的是,控制台窗口的原点坐标是(0, 0),而最大的坐标是缓冲区大小减1,例如当缓冲区大小为80*25时,其最大的坐标是(79, 24)。

ForestDB 2009-02-23
  • 打赏
  • 举报
回复
bAbsolute
绝对定位
[in]
输入值
If this parameter is TRUE, the coordinates specify the new upper-left and lower-right corners of the window.
TRUE表示绝对定位,坐标指明了窗口的新的左上角和右下角。
If it is FALSE, the coordinates are offsets to the current window-corner coordinates.
FALSE表示非绝对定位(相对定位),坐标是相对当前的角坐标的偏移。
unhappyless 2009-02-23
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 unhappyless 的回复:]
既然是偏移值,那便宜的值也不小,为什么程序运行看不出效果?
[/Quote]

up
kostion 2009-02-23
  • 打赏
  • 举报
回复
up
unhappyless 2009-02-23
  • 打赏
  • 举报
回复
[size=35px]既然是偏移值,那便宜的值也不小,为什么程序运行看不出效果? [/size]
ypb362148418 2009-02-23
  • 打赏
  • 举报
回复
SetConsoleWindowInfo

The SetConsoleWindowInfo function sets the current size and position of a console screen buffer's window.

SetConsoleWindowInfo函数集的SetConsoleWindowInfo当前大小和位置的控制台屏幕缓冲区的窗口。


bAbsolute
[in] If this parameter is TRUE, the coordinates specify the new upper-left and lower-right corners of the window. If it is FALSE, the coordinates are offsets to the current window-corner coordinates.

bAbsolute [in]如果这个参数是TURE,指定新的坐标左上角和右下角的角落窗口。如果是FALSE ,则坐标偏移到当前窗口角坐标。



jakqigle 2009-02-20
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 ch1oE 的回复:]
简单的中文解释下:
就是如果为true,就是绝对坐标,坐标指明了新窗口的左上右下坐标。 -- 例如当前窗口左上顶点为100,100 -- 你设置10,10 -- 则新的窗口坐标的左上顶点就是10,10
如果为false,就是相对坐标,是相对当前窗口的坐标偏移。 -- 例如当前窗口左上顶点为100,100 -- 你设置10,10 -- 则新窗口坐标的左上顶点就是110,110
明白否~?
[/Quote]
up
unhappyless 2009-02-19
  • 打赏
  • 举报
回复
既然是偏移值,那便宜的值也不小,为什么程序运行看不出效果?
colourfuldavid 2009-02-19
  • 打赏
  • 举报
回复
四楼的解释很详细
ch1oE 2009-02-19
  • 打赏
  • 举报
回复
简单的中文解释下:
就是如果为true,就是绝对坐标,坐标指明了新窗口的左上右下坐标。 -- 例如当前窗口左上顶点为100,100 -- 你设置10,10 -- 则新的窗口坐标的左上顶点就是10,10
如果为false,就是相对坐标,是相对当前窗口的坐标偏移。 -- 例如当前窗口左上顶点为100,100 -- 你设置10,10 -- 则新窗口坐标的左上顶点就是110,110
明白否~?
waizqfor 2009-02-19
  • 打赏
  • 举报
回复
如果它是错误的,坐标是对当前窗口角落坐标的距离
ch1oE 2009-02-19
  • 打赏
  • 举报
回复
恩。。应该是
如果为False, 则坐标为到当前窗口边角(左上角?)坐标的偏移。
ch1oE 2009-02-19
  • 打赏
  • 举报
回复
If it is FALSE, the coordinates are offsets to the current window-corner coordinates.

如果为False, 则坐标为到窗口边角坐标的偏移。

64,654

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧