16,472
社区成员
发帖
与我相关
我的任务
分享
movewindow的两种情况
1、
void MoveWindow(
int x,
int y,
int nWidth,
int nHeight,
BOOL bRepaint = TRUE
);
2、
void MoveWindow(
LPCRECT lpRect,
BOOL bRepaint = TRUE
);
这两种情况都是通过先获取窗口的大小,然后再使用movewindow来移动。
比如,假设是个button
CButton m_BtnObject;
CRect rect;
m_BtnObject.GetWindowRect(&rect);
假设采用第一个movewindow的话
m_BtnObject.MoveWindow(10, 10, rect.Width(),rect.Height(), TRUE);
假设采用第二种的话,需要填写一个新rect来作为参数
下面是RECT Structure
typedef struct tagRECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT;
再下面就是MSDN上给的赋值例子
//Alternate ways to intialize a RECT structure:
RECT rctA;
rctA.left = 20;
rctA.top = 30;
rctA.right = 180;
rctA.bottom = 230;
RECT rctB = {20,30,180,230};
楼主试验下就知道怎么赋值了,实践出真知