本文整理汇总了C++中gfx::Canvas::RotateTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ Canvas::RotateTransform方法的具体用法?C++ Canvas::RotateTransform怎么用?C++ Canvas::RotateTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gfx::Canvas
的用法示例。
在下文中一共展示了Canvas::RotateTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawString
//.........这里部分代码省略.........
else
{
w = rect->Width;
}
h = (REAL)meterRect.Height;
}
}
else
{
if (m_ClipStringW == -1)
{
// Clip text if already larger than ClipStringH
if (m_ClipStringH != -1 && rect->Height > (REAL)m_ClipStringH)
{
m_NeedsClipping = true;
rect->Height = (REAL)m_ClipStringH;
}
updateSize = false;
}
else
{
if (rect->Width > (REAL)m_ClipStringW)
{
w = (REAL)m_ClipStringW;
m_NeedsClipping = true;
}
else
{
w = rect->Width;
}
h = rect->Height;
}
}
if (updateSize)
{
UINT lines = 0;
RectF layout((REAL)meterRect.X, (REAL)meterRect.Y, w, h);
if (canvas.MeasureTextLinesW(string, stringLen, *m_TextFormat, layout, lines) &&
lines != 0)
{
rect->Width = w;
rect->Height = layout.Height;
if (m_HDefined || (m_ClipStringH != -1 && rect->Height > (REAL)m_ClipStringH))
{
rect->Height = m_HDefined ? (REAL)meterRect.Height : (REAL)m_ClipStringH;
}
}
}
}
}
else
{
RectF rcDest((REAL)meterRect.X, (REAL)meterRect.Y, (REAL)meterRect.Width, (REAL)meterRect.Height);
m_Rect = rcDest;
if (m_Angle != 0.0f)
{
const float baseX = (float)Meter::GetX();
canvas.RotateTransform(CONVERT_TO_DEGREES(m_Angle), baseX, (REAL)meterRect.Y, -baseX, -(REAL)meterRect.Y);
}
if (m_Effect != EFFECT_NONE)
{
SolidBrush solidBrush(m_EffectColor);
RectF rcEffect(rcDest);
if (m_Effect == EFFECT_SHADOW)
{
rcEffect.Offset(1, 1);
canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
}
else //if (m_Effect == EFFECT_BORDER)
{
rcEffect.Offset(0, 1);
canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
rcEffect.Offset(1, -1);
canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
rcEffect.Offset(-1, -1);
canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
rcEffect.Offset(-1, 1);
canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
}
}
SolidBrush solidBrush(m_Color);
canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcDest, solidBrush);
if (m_Angle != 0.0f)
{
canvas.ResetTransform();
}
}
return true;
}