Exemple #1
0
void CCell::Format(long left, long top, long right, long bottom, long flag)
{
	POINT pot;
	POSITION pos;
	CElement *pElement;

	switch(flag){
	case FM_A2L:
		pot.x=left-Left();
		pot.y=0;
		MoveInCell(pot);
		break;
	case FM_A2C:
		pot.x=(left-Left()+right-Right())/2;
		pot.y=0;
		MoveInCell(pot);
		break;
	case FM_A2R:
		pot.x=right-Right();
		pot.y=0;
		MoveInCell(pot);
		break;
	case FM_A2T:
		pot.x=0;
		pot.y=top-Top();
		MoveInCell(pot);
		break;
	case FM_A2M:
		pot.x=0;
		pot.y=(top-Top()+bottom-Bottom())/2;
		MoveInCell(pot);
		break;
	case FM_A2B:
		pot.x=0;
		pot.y=bottom-Bottom();
		MoveInCell(pot);
		break;
	case FM_A2CM:
		pot.x=(left-Left()+right-Right())/2;
		pot.y=(top-Top()+bottom-Bottom())/2;
		MoveInCell(pot);
		break;
	case FM_R2W:
		for(pos=m_Elements.GetHeadPosition();pos!=NULL;){		
			pElement=(CElement *)(m_Elements.GetNext(pos));
			pElement->Format(left,top,right,bottom,FM_R2W);
		}
		break;
	case FM_R2U:
		for(pos=m_Elements.GetHeadPosition();pos!=NULL;){		
			pElement=(CElement *)(m_Elements.GetNext(pos));
			pElement->Format(left,top,right,bottom,FM_R2U);
		}
		break;
	case FM_F2Z:
		pot.x=left+right-Left()-Right();
		pot.y=0;
		MoveInCell(pot);
		break;
	case FM_F2I:
		pot.x=0;
		pot.y=top+bottom-Top()-Bottom();
		MoveInCell(pot);
		break;
	case FM_S2G:
		break;
	}

}