如何在指定矩形中旋转显示文字

如何在指定矩形中旋转显示文字,第1张

如何在指定矩形中旋转显示文字,第2张

//////////////////////////////////////////////////////////////////////////荆州徐
//参数:
/PDC: DC指针
//str:display text
/rect
双弧度= pi * 2 / 360 *角度;

//获取显示文本的中心点
csize text size = PDC-> GetText Extent(str);
c point center;
center . x = text size . CX/2;
center . y = textsize . cy/2;

//计算显示文本的新中心点
c point r center;
rcenter.x = long(cos(弧度)* center.x - sin(弧度)* center . y);
rcenter.y = long(sin(弧度)* center.x + cos(弧度)* center . y);

//draw text
PDC-> settext align(ta _ baseline);
pDC->SetBkMode(透明);
pDC-> ext textout(rect . left+rect。Width() / 2 - rcenter.x,
rect.top + rect。Height() / 2 + rcenter.y,
no options,rect,str,NULL);
}

用法:
drawratedtext(PDC," VC知识库",CRECT (100,100,300,300),15,eto _ clipped);

位律师回复
DABAN RP主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
白度搜_经验知识百科全书 » 如何在指定矩形中旋转显示文字

0条评论

发表评论

提供最优质的资源集合

立即查看 了解详情