您的位置:首页 > 其它

GDI+ 文字旋转后 位置变化.

2014-12-30 11:56 323 查看
StringFormat format;

format.SetAlignment(StringAlignmentCenter);

format.SetLineAlignment(StringAlignmentNear);

Gdiplus::Font clrFont(L"Arial",65,FontStyleRegular,UnitPixel );

SolidBrush blackBrush(Color(255, 0, 0, 0));

RectF rcText(PointF(rcBounds.left-m_fSideWidth*cxInch*0.9,rcBounds.top+nw+txtSize/2),SizeF(txtSize,txtSize));

PointF txtPoint[4]={

PointF(rcText.GetLeft(),rcText.GetTop()),

PointF(rcText.GetRight(),rcText.GetTop()),

PointF(rcText.GetLeft(),rcText.GetBottom()),

PointF(rcText.GetRight(),rcText.GetBottom())

};

graph.RotateTransform(REAL(-90)); // 旋转 角度

graph.TransformPoints(CoordinateSpaceWorld,CoordinateSpacePage,txtPoint,4);//求旋转后的位置

RectF rcTrText(txtPoint[0],SizeF(txtSize,txtSize));

graph.DrawString(IntToStr(nw/cxInch),-1,&clrFont,rcTrText,&format,&blackBrush);

graph.ResetTransform();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: