如何在指定矩形中鏇轉顯示文字
//////////////////////////////////////////////////////////////////////////荊州徐
//蓡數:
/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);
0條評論