Click here to Skip to main content
15,899,313 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Problem with DataGridView Pin
drexler_kk23-Feb-09 16:28
drexler_kk23-Feb-09 16:28 
Questionlabel Pin
aswd22-Feb-09 16:03
aswd22-Feb-09 16:03 
AnswerRe: label Pin
Mycroft Holmes22-Feb-09 16:15
professionalMycroft Holmes22-Feb-09 16:15 
AnswerRe: label Pin
Tom Deketelaere22-Feb-09 22:42
professionalTom Deketelaere22-Feb-09 22:42 
GeneralRe: label Pin
aswd23-Feb-09 1:29
aswd23-Feb-09 1:29 
GeneralRe: label Pin
Tom Deketelaere23-Feb-09 1:42
professionalTom Deketelaere23-Feb-09 1:42 
GeneralRe: label Pin
aswd23-Feb-09 1:47
aswd23-Feb-09 1:47 
GeneralRe: label Pin
Tom Deketelaere23-Feb-09 2:07
professionalTom Deketelaere23-Feb-09 2:07 
Public Class VerticalLabel
    Inherits Label

    Public Sub New()
        Me.AutoSize = False
    End Sub
    Public Overrides Property AutoSize() As Boolean
        Get
            Return MyBase.AutoSize
        End Get
        Set(ByVal value As Boolean)
            MyBase.AutoSize = False
        End Set
    End Property

    Protected Overloads Overrides Sub OnPaint(ByVal e As PaintEventArgs)
        Dim graphics As Graphics = e.Graphics
        Dim text As String = Me.Text
        Dim width As Integer = 0
        Dim height As Integer = 0
        Dim textBrush As Brush = New SolidBrush(Me.ForeColor)
        For Each c As Char In text.ToCharArray()
            Dim sw As Single = graphics.MeasureString(c, Me.Font).Width
            If sw > width Then
                width = sw
            End If
            Dim sh As Single = graphics.MeasureString(c, Me.Font).Height
            height += sh
            graphics.DrawString(c, Me.Font, textBrush, 0, height - sh)
        Next
        Me.Width = width
        Me.Height = height + 2
    End Sub

    Private Sub VerticalLabel_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.TextChanged
        Me.Refresh()
    End Sub
End Class


This should do what you want (very basic so you might want to add a bit, like an option to set it to vertical or horizontal,...)
GeneralRe: label Pin
aswd23-Feb-09 15:15
aswd23-Feb-09 15:15 
GeneralRe: label Pin
Tom Deketelaere23-Feb-09 20:47
professionalTom Deketelaere23-Feb-09 20:47 
GeneralRe: label Pin
CPallini23-Feb-09 2:55
mveCPallini23-Feb-09 2:55 
GeneralRe: label Pin
Tom Deketelaere23-Feb-09 3:04
professionalTom Deketelaere23-Feb-09 3:04 
Questionhow to get reset an application without reopen the application? Pin
aswd22-Feb-09 15:52
aswd22-Feb-09 15:52 
AnswerRe: how to get reset an application without reopen the application? Pin
Mycroft Holmes22-Feb-09 16:16
professionalMycroft Holmes22-Feb-09 16:16 
AnswerRe: how to get reset an application without reopen the application? Pin
dan!sh 22-Feb-09 20:20
professional dan!sh 22-Feb-09 20:20 
QuestionEvents in vb.net Pin
udikantz22-Feb-09 15:23
udikantz22-Feb-09 15:23 
GeneralRe: Events in vb.net Pin
Luc Pattyn22-Feb-09 15:26
sitebuilderLuc Pattyn22-Feb-09 15:26 
GeneralRe: Events in vb.net Pin
udikantz22-Feb-09 17:36
udikantz22-Feb-09 17:36 
Questionhelp deploying vb.net applications Pin
Okiemute Omuta22-Feb-09 11:48
Okiemute Omuta22-Feb-09 11:48 
AnswerRe: help deploying vb.net applications Pin
JMummery22-Feb-09 12:15
professionalJMummery22-Feb-09 12:15 
GeneralRe: help deploying vb.net applications Pin
Okiemute Omuta22-Feb-09 12:59
Okiemute Omuta22-Feb-09 12:59 
AnswerRe: help deploying vb.net applications Pin
JUNEYT22-Feb-09 12:26
JUNEYT22-Feb-09 12:26 
QuestionCOPY WEB TABLE DATA TO EXCEL SPREADSHEET VB MACRO CODE $$$[modified] Pin
pcfacile22-Feb-09 9:43
pcfacile22-Feb-09 9:43 
QuestionDifference between VB.NET 2008 and 2005 and 2002(3) ? Pin
Mohammad Reza Sabouri22-Feb-09 5:31
Mohammad Reza Sabouri22-Feb-09 5:31 
AnswerRe: Difference between VB.NET 2008 and 2005 and 2002(3) ? Pin
Kevin McFarlane22-Feb-09 6:57
Kevin McFarlane22-Feb-09 6:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.