I fixed the issue. Have a look at the original OnPaint:
Just replace the line:Code:Private Overloads Sub OnPaint(ByVal sender As Object, _ ByVal e As PaintEventArgs) Dim str As String = m_MarqueeText Dim g As Graphics = e.Graphics Dim szf As SizeF g.SmoothingMode = SmoothingMode.HighQuality szf = g.MeasureString(m_MarqueeText, Me.Font) If m_LeftToRight = Direction.Right Then If startPosition > Me.Width Then startPosition = -szf.Width Else startPosition += 1 End If ElseIf m_LeftToRight = Direction.Left Then If startPosition < -szf.Width Then startPosition = szf.Width 'Because of this line, the text will start a width of the text to the right instead of from the right edge of the control Else startPosition -= 1 End If End If g.DrawString(m_MarqueeText, Me.Font, New SolidBrush(Me.ForeColor), startPosition, CSng(0 + (Me.Height / 2) - (szf.Height / 2))) End Sub
with this one:Code:startPosition = szf.Width
Code:startPosition = Me.Width





Reply With Quote