15,979
社区成员
发帖
与我相关
我的任务
分享
//获取窗口大小
CRect windowRect;
GetWindowRect(&windowRect);
//获取客户区大小
CRect clientRect;
GetClientRect(&clientRect);
//获取窗口比客户区大多少
int iX = windowRect.Width() - clientRect.Width();
int iY = windowRect.Height() - clientRect.Height();
CSize size;
size = m_Grid1.GetSize();
int xSet = size.cx + iX;
int ySet = size.cy + iY;
m_Grid1.SetWindowPos(NULL, 0, 0, xSet - iX , xSet - iY, SWP_NOMOVE|SWP_NOZORDER);
SetWindowPos(NULL, 0, 0, xSet, ySet, SWP_NOMOVE|SWP_NOZORDER);
//CGridCtrl 类 新添加自定义函数,为了获取CGridCtrl的有效数据尺寸
CSize CGridCtrl::GetSize()
{
CSize size;
CRect tmpRect;
for (int i = 0; i < GetRowCount(); i++)
{
size.cy += GetRowHeight(i);
}
for (int i = 0; i < GetColumnCount(); i++)
{
size.cx += GetColumnWidth(i);
}
return size;
}