Пример #1
0
void CText::Format(long left, long top, long right, long bottom, long flag)
{
    long ldx,ldy;
    switch(flag) {
    case FM_A2L:
        ldx=left-Left();
        m_lx1+=ldx;
        m_lx2+=ldx;
        break;
    case FM_A2C:
        ldx=(left+right-Left()-Right())/2;
        m_lx1+=ldx;
        m_lx2+=ldx;
        break;
    case FM_A2R:
        ldx=right-Right();
        m_lx1+=ldx;
        m_lx2+=ldx;
        break;
    case FM_A2T:
        ldy=top-Top();
        m_ly1+=ldy;
        m_ly2+=ldy;
        break;
    case FM_A2M:
        ldy=(top+bottom-Top()-Bottom())/2;
        m_ly1+=ldy;
        m_ly2+=ldy;
        break;
    case FM_A2B:
        ldy=bottom-Bottom();
        m_ly1+=ldy;
        m_ly2+=ldy;
        break;
    case FM_A2CM:
        ldx=(left+right-Left()-Right())/2;
        m_lx1+=ldx;
        m_lx2+=ldx;
        ldy=(top+bottom-Top()-Bottom())/2;
        m_ly1+=ldy;
        m_ly2+=ldy;
        break;
    case FM_R2W:
        ldx=(left+right)/2;
        ldy=(top+bottom)/2;
        R2W(ldx,ldy,&m_lx1,&m_ly1);
        R2W(ldx,ldy,&m_lx2,&m_ly2);
        m_font.lfEscapement+=2700;
        m_font.lfEscapement%=3600;
        break;
    case FM_R2U:
        ldx=(left+right)/2;
        ldy=(top+bottom)/2;
        R2U(ldx,ldy,&m_lx1,&m_ly1);
        R2U(ldx,ldy,&m_lx2,&m_ly2);
        m_font.lfEscapement+=900;
        m_font.lfEscapement%=3600;
        break;
    case FM_F2Z:
        ldx=(left+right)/2;
        F2Z(ldx,&m_lx1);
        F2Z(ldx,&m_lx2);
        if(m_lx1>m_lx2) {
            ldx=m_lx1;
            m_lx1=m_lx2;
            m_lx2=m_lx1;
        }
        break;
    case FM_F2I:
        ldy=(top+bottom)/2;
        F2I(ldy,&m_ly1);
        F2I(ldy,&m_ly2);
        if(m_ly1>m_ly2) {
            ldy=m_ly1;
            m_ly1=m_ly2;
            m_ly2=ldy;
        }
        break;
    case FM_S2G:
        break;
    }
}
Пример #2
0
void CArc::Format(long left, long top, long right, long bottom, long flag)
{
	long ldx,ldy;
	switch(flag){
	case FM_A2L:
		ldx=left-Left();
		m_lx1+=ldx;
		m_lx2+=ldx;
		m_lx3+=ldx;
		m_lx4+=ldx;
		break;
	case FM_A2C:
		ldx=(left+right-Left()-Right())/2;
		m_lx1+=ldx;
		m_lx2+=ldx;
		m_lx3+=ldx;
		m_lx4+=ldx;
		break;
	case FM_A2R:
		ldx=right-Right();
		m_lx1+=ldx;
		m_lx2+=ldx;
		m_lx3+=ldx;
		m_lx4+=ldx;
		break;
	case FM_A2T:
		ldy=top-Top();
		m_ly1+=ldy;
		m_ly2+=ldy;
		m_ly3+=ldy;
		m_ly4+=ldy;
		break;
	case FM_A2M:
		ldy=(top+bottom-Top()-Bottom())/2;
		m_ly1+=ldy;
		m_ly2+=ldy;
		m_ly3+=ldy;
		m_ly4+=ldy;
		break;
	case FM_A2B:
		ldy=bottom-Bottom();
		m_ly1+=ldy;
		m_ly2+=ldy;
		m_ly3+=ldy;
		m_ly4+=ldy;
		break;
	case FM_A2CM:
		ldx=(left+right-Left()-Right())/2;
		m_lx1+=ldx;
		m_lx2+=ldx;
		m_lx3+=ldx;
		m_lx4+=ldx;
		ldy=(top+bottom-Top()-Bottom())/2;
		m_ly1+=ldy;
		m_ly2+=ldy;
		m_ly3+=ldy;
		m_ly4+=ldy;
		break;
	case FM_R2W:
		ldx=(left+right)/2;
		ldy=(top+bottom)/2;
		R2W(ldx,ldy,&m_lx1,&m_ly1);
		R2W(ldx,ldy,&m_lx2,&m_ly2);
		R2W(ldx,ldy,&m_lx3,&m_ly3);
		R2W(ldx,ldy,&m_lx4,&m_ly4);
		break;
	case FM_R2U:
		ldx=(left+right)/2;
		ldy=(top+bottom)/2;
		R2U(ldx,ldy,&m_lx1,&m_ly1);
		R2U(ldx,ldy,&m_lx2,&m_ly2);
		R2U(ldx,ldy,&m_lx3,&m_ly3);
		R2U(ldx,ldy,&m_lx4,&m_ly4);
		break;
	case FM_F2Z:
		ldx=(left+right)/2;
		F2Z(ldx,&m_lx1);
		F2Z(ldx,&m_lx2);
		F2Z(ldx,&m_lx3);
		F2Z(ldx,&m_lx4);
		ldx=m_lx3;
		ldy=m_ly3;
		m_lx3=m_lx4;
		m_ly3=m_ly4;
		m_lx4=ldx;
		m_ly4=ldy;
		break;
	case FM_F2I:
		ldy=(top+bottom)/2;
		F2I(ldy,&m_ly1);
		F2I(ldy,&m_ly2);
		F2I(ldy,&m_ly3);
		F2I(ldy,&m_ly4);
		ldx=m_lx3;
		ldy=m_ly3;
		m_lx3=m_lx4;
		m_ly3=m_ly4;
		m_lx4=ldx;
		m_ly4=ldy;
		break;
	case FM_S2G:
		m_lx1=(m_lx1+right/2)-(m_lx1+right/2)%right;
		m_lx2=(m_lx2+right/2)-(m_lx2+right/2)%right;
		m_lx3=(m_lx3+right/2)-(m_lx3+right/2)%right;
		m_lx4=(m_lx4+right/2)-(m_lx4+right/2)%right;
		m_ly1=(m_ly1+bottom/2)-(m_ly1+bottom/2)%bottom;
		m_ly2=(m_ly2+bottom/2)-(m_ly2+bottom/2)%bottom;
		m_ly3=(m_ly3+bottom/2)-(m_ly3+bottom/2)%bottom;
		m_ly4=(m_ly4+bottom/2)-(m_ly4+bottom/2)%bottom;
		break;
	}
}
Пример #3
0
void CLine::Format(long left, long top, long right, long bottom, long flag)
{
    long ldx,ldy;
    switch(flag) {
    case FM_A2L:
        ldx=left-Left();
        m_lx1+=ldx;
        m_lx2+=ldx;
        break;
    case FM_A2C:
        ldx=(left+right-Left()-Right())/2;
        m_lx1+=ldx;
        m_lx2+=ldx;
        break;
    case FM_A2R:
        ldx=right-Right();
        m_lx1+=ldx;
        m_lx2+=ldx;
        break;
    case FM_A2T:
        ldy=top-Top();
        m_ly1+=ldy;
        m_ly2+=ldy;
        break;
    case FM_A2M:
        ldy=(top+bottom-Top()-Bottom())/2;
        m_ly1+=ldy;
        m_ly2+=ldy;
        break;
    case FM_A2B:
        ldy=bottom-Bottom();
        m_ly1+=ldy;
        m_ly2+=ldy;
        break;
    case FM_A2CM:
        ldx=(left+right-Left()-Right())/2;
        m_lx1+=ldx;
        m_lx2+=ldx;
        ldy=(top+bottom-Top()-Bottom())/2;
        m_ly1+=ldy;
        m_ly2+=ldy;
        break;
    case FM_R2W:
        ldx=(left+right)/2;
        ldy=(top+bottom)/2;
        R2W(ldx,ldy,&m_lx1,&m_ly1);
        R2W(ldx,ldy,&m_lx2,&m_ly2);
        break;
    case FM_R2U:
        ldx=(left+right)/2;
        ldy=(top+bottom)/2;
        R2U(ldx,ldy,&m_lx1,&m_ly1);
        R2U(ldx,ldy,&m_lx2,&m_ly2);
        break;
    case FM_F2Z:
        ldx=(left+right)/2;
        F2Z(ldx,&m_lx1);
        F2Z(ldx,&m_lx2);
        break;
    case FM_F2I:
        ldy=(top+bottom)/2;
        F2I(ldy,&m_ly1);
        F2I(ldy,&m_ly2);
        break;
    case FM_S2G:
        break;
    }
}