测了一下,汉字体字确实没办法旋转,是竖着打印,但汉字字体没有旋转void CMyTestPrj2View::OnTestGdiplus()
{
// TODO: 在此添加命令处理程序代码 StringFormat stringformat;
stringformat.SetFormatFlags(StringFormatFlagsDirectionVertical); Graphics graphics(this->m_hWnd);
SolidBrush brush(Color(255, 0, 0, 255));
FontFamily fontFamily(L"宋体");//Times New Roman");
Gdiplus::Font font(&fontFamily, 24, FontStyleRegular, UnitPixel);
PointF pointF(10.0f, 20.0f); graphics.DrawString(L"Hello World--中国!", -1, &font, pointF, &brush); graphics.DrawString(L"Hello World--中国!",-1,&font, pointF,&stringformat,&brush); }
{
// TODO: 在此添加命令处理程序代码 StringFormat stringformat;
stringformat.SetFormatFlags(StringFormatFlagsDirectionVertical); Graphics graphics(this->m_hWnd);
SolidBrush brush(Color(255, 0, 0, 255));
FontFamily fontFamily(L"宋体");//Times New Roman");
Gdiplus::Font font(&fontFamily, 24, FontStyleRegular, UnitPixel);
PointF pointF(10.0f, 20.0f); graphics.DrawString(L"Hello World--中国!", -1, &font, pointF, &brush); graphics.DrawString(L"Hello World--中国!",-1,&font, pointF,&stringformat,&brush); }
你打开 word 看看字体, 凡是字体前有@ 的就是转90 度的字体。
::OnDraw(CDC *pDC)
{
CRect rc;
GetCilentRect(rc);
CString str(_T("通过旋转"));
CFont font;
LOGFONT lf;
memset(&lf,0,sizeof(lf);
lf.lfCharSet=GB2312_CHARSET;
strcpy(lf.lfFaceName,"@宋体");
lf.lfEscapement=2700;// 270度
font.CreateFontIndirect(&lf);
CFont *pOld=pDC->SelectObject(font);
pDC->TextOut(rc.left+rc.Width()/2,rc.top+40,str);
SelectObject(pOld);
DeleteObject(font);
}
手打的!其实 就是 lf.lfEscapement=2700;// 270度
{ // lf LONG lfHeight;
LONG lfWidth;
LONG lfEscapement;
LONG lfOrientation;
LONG lfWeight;
BYTE lfItalic;
BYTE lfUnderline;
BYTE lfStrikeOut;
BYTE lfCharSet;
BYTE lfOutPrecision;
BYTE lfClipPrecision;
BYTE lfQuality;
BYTE lfPitchAndFamily;
TCHAR lfFaceName[LF_FACESIZE];
} LOGFONT;lfEscapement:
以十分之一度为单位指定每一行文本输出时相对于页面底端的角度。
FontFamily fontFamily(L"宋体");
Font font(&fontFamily, 14, FontStyleRegular, UnitPoint);
PointF pointF(40.0f, 10.0f);
StringFormat stringFormat;
SolidBrush solidBrush(Color(255, 0, 0, 255));
stringFormat.SetFormatFlags(StringFormatFlagsDirectionVertical);
Graphics graphics(pDC->m_hDC);
graphics.DrawString(string, -1, &font, pointF, &stringFormat, &solidBrush);
std::vector<Point>::iterator iterPt;
GraphicsPath path;
path.AddLines(&m_vPts[0],m_vPts.size());
g->DrawPath(&pen,&path);
for(iterPt = m_vPts.begin(); iterPt != m_vPts.end(); iterPt++)
{
path.AddEllipse(iterPt->X-2,iterPt->Y-2,4,4);
g->FillPath(&brush,&path);
}
Pts[0]=PointF(18.0f, 20.0f);
Pts[1]=PointF(2*18.0f, 2*20.0f);
Pts[2]=PointF(3*18.0f, 3*20.0f);
Pts[3]=PointF(4*18.0f, 4*20.0f);
Pts[4]=PointF(5*18.0f, 5*20.0f);
Pts[5]=PointF(6*18.0f, 6*20.0f);
Pts[6]=PointF(7*18.0f, 7*20.0f);
Pts[7]=PointF(8*18.0f, 8*20.0f);
GraphicsPath path;
path.AddLines(Pts,8);
Pen pen(&solidBrush);
graphics.DrawPath(&pen,&path);
for(int i=0; i<8; i++)
{
path.AddEllipse(Pts[i].X-2.0f,Pts[i].Y-2.0f,4.0f,4.0f);
graphics.FillPath(&solidBrush,&path);
}
{
for(int i=0;i<n;i++)
{
//为什么要用y、z轴的值减去x轴值投影45度的值是什么数学原理?之前说的忘记了。
P2D[i][0]=P3D[i][1]-P3D[i][0] / sqrt(2.0);
P2D[i][1]=-P3D[i][2]+P3D[i][0] / sqrt(2.0);
}
}
假如不考虑电脑与坐标轴的y轴值是相反方向的话。
是 y - x*45度 、z - x*45度吧。这里减去x*45度 。相减是什么作用?