vc,GetClientRect()在什么情况下才能用
我想从窗口最右边滚动文字,在C*View中定义一个CPoint变量point作为TextOut的输出位置。在初始化point时,需要得到窗口的大小,所以,我用GetCli...
我想从窗口最右边滚动文字,在C*View中定义一个CPoint变量point作为TextOut的输出位置。在初始化point时,需要得到窗口的大小,所以,我用GetClientRect().结果不行,请为什么呀?
那么应该怎么做呢? 展开
那么应该怎么做呢? 展开
2个回答
展开全部
MSDN原文如下:
GetClientRect
The GetClientRect function retrieves the coordinates of a window's client area. The client coordinates specify the upper-left and lower-right corners of the client area. Because client coordinates are relative to the upper-left corner of a window's client area, the coordinates of the upper-left corner are (0,0).
BOOL GetClientRect(
HWND hWnd, // handle to window
LPRECT lpRect // address of structure for client coordinates
);
Parameters
hWnd
Handle to the window whose client coordinates are to be retrieved.
lpRect
Pointer to aRECT structure that receives the client coordinates. The left and top members are zero. The right and bottom members contain the width and height of the window.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, callGetLastError
中文如下:
GetClientRect
函数功能:
该函数获取窗口客户区的坐标。客户区坐标指定客户区的左上角和右下角。由于客户区坐标是相对子窗口客户区的左上角而言的,因此左上角坐标为(0,0)
函数原型:BOOL GetClientRect(HWND hWnd,LPRECT lpRect);
在Visual Studio 2005中,该函数的原型为 void GetWindowRect(LPRECT lpRect) const;
参数:
hWnd是程序窗口的句柄。lpRect是一个指标,指向一个RECT型态的rectangle结构.该结构有四个LONG字段,分别为left,top,right和bottom.GetClientRect将这四个字段设定为窗口显示区域的尺寸。left和top字段通常设定为0。right和bottom字段设定为显示区域的宽度和高度(像素点数)。
GetClientRect
The GetClientRect function retrieves the coordinates of a window's client area. The client coordinates specify the upper-left and lower-right corners of the client area. Because client coordinates are relative to the upper-left corner of a window's client area, the coordinates of the upper-left corner are (0,0).
BOOL GetClientRect(
HWND hWnd, // handle to window
LPRECT lpRect // address of structure for client coordinates
);
Parameters
hWnd
Handle to the window whose client coordinates are to be retrieved.
lpRect
Pointer to aRECT structure that receives the client coordinates. The left and top members are zero. The right and bottom members contain the width and height of the window.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, callGetLastError
中文如下:
GetClientRect
函数功能:
该函数获取窗口客户区的坐标。客户区坐标指定客户区的左上角和右下角。由于客户区坐标是相对子窗口客户区的左上角而言的,因此左上角坐标为(0,0)
函数原型:BOOL GetClientRect(HWND hWnd,LPRECT lpRect);
在Visual Studio 2005中,该函数的原型为 void GetWindowRect(LPRECT lpRect) const;
参数:
hWnd是程序窗口的句柄。lpRect是一个指标,指向一个RECT型态的rectangle结构.该结构有四个LONG字段,分别为left,top,right和bottom.GetClientRect将这四个字段设定为窗口显示区域的尺寸。left和top字段通常设定为0。right和bottom字段设定为显示区域的宽度和高度(像素点数)。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询