研究1

int CImageDoc::lookregion(int cx,int cy,int option)
{
	int mh=m_DIB.m_nHeight,mw=m_DIB.m_nWidth;
	if(cx<0||cy<0||cx>(mw-1)||cy>(mh-1))
	{
		AfxMessageBox("Click on the map!");
		return -1;
	}
	curRegion=m_HC.tag[cy*mw+cx];
	if(curRegion<0)
	{
		AfxMessageBox("tag array of region labels is modified or illegal");
		return -1;
	}
	switch (option)
	{
	case 0:
	default:
		{int area=m_HC.GetSize(curRegion);
		CRect rect=m_HC.GetBoundBox(curRegion);
		m_DIB.lookregion(curRegion,m_HC.tag,rect,area);
		break;}
	case 1:
		m_HC.RegMoment(curRegion);
		break;
	}
	return curRegion;
}
原文地址:https://www.cnblogs.com/xiangshancuizhu/p/2123561.html