프로그래밍/C# Text Rotate 프로그래머 ^.^ 2014. 11. 7. 00:13 RectangleF m_Rect = new RectangleF(10, 10, 100, 100); float RotateTheta = 90.0f; public static PointF Center(RectangleF rect) { return new PointF((rect.Left + rect.Right) / 2.0f, (rect.Top + rect.Bottom) / 2.0f); } private void DEBUG_RotateText(Graphics g) { GraphicsContainer container = g.BeginContainer(); g.SmoothingMode = SmoothingMode.AntiAlias; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; PointF center = Util.Center(m_Rect); // Center를 중심점으로 설정. g.TranslateTransform(center.X, center.Y); // Rotate 각 설정 g.RotateTransform(m_RotateTheta); float x = m_Rect.X; float y = m_Rect.Y; foreach (string txt in m_TextList) { SizeF strSize = g.MeasureString(txt, m_Font); g.DrawRectangle(Pens.Blue, -m_Rect.Width / 2.0f, -m_Rect.Height / 2.0f, strSize.Width, strSize.Height); g.DrawString(txt, m_Font, Brushes.Red, -m_Rect.Width / 2.0f, -m_Rect.Height / 2.0f); y += strSize.Height; } g.ResetTransform(); g.EndContainer(container); } 공유하기 게시글 관리 프로그래밍 Tips 저작자표시 비영리 변경금지 '프로그래밍 > C#' 카테고리의 다른 글 Retangle Rotation (0) 2014.11.06 C# Font XML로 저장 및 읽기 (0) 2014.11.04 '프로그래밍/C#' Related Articles Retangle Rotation C# Font XML로 저장 및 읽기