void CJulia_IFSView::OnInitialUpdate()
{
CView::OnInitialUpdate();
CRect rt;
GetClientRect(&rt);
w=rt.Width();
h=rt.Height();
map = new BYTE*[w];
for(int i=0;i<w; i++)
map[i] = new BYTE[h]; for(int m=0; m<w; m++)
for(int n=0; n<h; n++)
map[m][n] = 0;
}
{
CView::OnInitialUpdate();
CRect rt;
GetClientRect(&rt);
w=rt.Width();
h=rt.Height();
map = new BYTE*[w];
for(int i=0;i<w; i++)
map[i] = new BYTE[h]; for(int m=0; m<w; m++)
for(int n=0; n<h; n++)
map[m][n] = 0;
}
GetClientRect(&rt);
w=rt.Width();
h=rt.Height();
===========
这段是获取客户区的范围,放到rt中,w放宽,h放高。map = new BYTE*[w];
for(int i=0;i<w; i++)
map[i] = new BYTE[h];for(int m=0; m<w; m++)
for(int n=0; n<h; n++)
map[m][n] = 0;
=============
动态生成BYTE指针数组,个数是w个(即上面的宽)下面又分别动态生成个数为h个的BYTE数组,然后初始化,最终的效果就是生成一个w*h的二维BYTE数组,并初始化为0
GetClientRect(&rt);
w=rt.Width();
h=rt.Height();
========================
1楼解释忒清楚了,我就说下CRect这个类吧,如下结构体
//The CRect class is similar to a Windows RECT structure. CRect also includes member functions to manipulate CRect objects and Windows RECT structures.
typedef struct tagRECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT;map = new BYTE*[w];
for(int i=0;i<w; i++)
map[i] = new BYTE[h];for(int m=0; m<w; m++)
for(int n=0; n<h; n++)
map[m][n] = 0;========================这里是动态生成指针数组,下面记得要delete掉