Rotating Text on a Picture Box

Hi,

Is there anyway to rotate text on a picture box other than using the vertical text flag like this? Custome angles would be nice too.

Richard

[260 byte] By [Richard_11463] at [2008-1-28]
# 1

Perhaps this will help you.

Private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Const LF_FACESIZE = 32
Structure LOGFONT
Dim lfHeight As Long
Dim lfWidth As Long
Dim lfEscapement As Long
Dim lfOrientation As Long
Dim lfWeight As Long
Dim lfItalic As Byte
Dim lfUnderline As Byte
Dim lfStrikeOut As Byte
Dim lfCharSet As Byte
Dim lfOutPrecision As Byte
Dim lfClipPrecision As Byte
Dim lfQuality As Byte
Dim lfPitchAndFamily As Byte
Dim lfFaceName(LF_FACESIZE) As Byte
End Structure

SpawnProduction at 2007-9-8 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 2

Have a look at this control that I just whipped up:


public class TextControl : System.Windows.Forms.Control
{
public TextControl()
{
}

protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;

using (StringFormat format = new StringFormat(StringFormatFlags.DirectionVertical))
{
using (SolidBrush brush = new SolidBrush(ForeColor))
{
g.DrawString(Text, Font, brush, 0, 0, format);
}
}
}
}


DavidM.Kean at 2007-9-8 > top of Msdn Tech,Visual Basic,Visual Basic Language...