첨부 소스 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170
using System.Drawing;
using System.Drawing.Drawing2D;

#region 회전 텍스트 그리기 - DrawRotatedText(graphics, font, brush, text, x, y, angle)

/// <summary>
/// 회전 텍스트 그리기
/// </summary>
/// <param name="graphics">그래픽스</param>
/// <param name="font">폰트</param>
/// <param name="brush">브러시</param>
/// <param name="text">텍스트</param>
/// <param name="x">X</param>
/// <param name="y">Y</param>
/// <param name="angle">각도</param>
public void DrawRotatedText(Graphics graphics, Font font, Brush brush, string text, float x, float y, float angle)
{
    GraphicsState state = graphics.Save();

    graphics.ResetTransform();

    graphics.RotateTransform(angle);

    graphics.TranslateTransform(x, y, MatrixOrder.Append);

    using(StringFormat stringFormat = new StringFormat())
    {
        stringFormat.Alignment     = StringAlignment.Center;
        stringFormat.LineAlignment = StringAlignment.Center;

        graphics.DrawString(text, font, brush, 0, 0, stringFormat);
    }

    graphics.Restore(state);
}

#endregion
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요