Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

scrolling text / Marque visual studio express / vb.net

Posted on 2008-11-05
1
Medium Priority
?
780 Views
Last Modified: 2008-11-19
i'v found several scrolling text / marque examples on the net .. i'v tested a lot of them .. but some some reason all of them are not smooth .. text is 'blinking'  .. anyone knows a good marque control? a paid one is also good (within budget:) ) .. i really tried alot of them..

thanks in advanced
0
Comment
Question by:Amien90
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1500 total points
ID: 22895849
Here is a crude custom control that I have in my bag-o-tricks, that doesn't "blink", and is pretty smooth, that you can tinker with (if you wish):
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Windows.Forms
Imports System.Drawing
Imports System.ComponentModel
 
Namespace ResearchAndDevelopment
 
 
    Public Class Marquee
        Inherits Panel
 
        Private _x As Double = 5
 
        Private _Timer As Timer = Nothing
 
        Public Sub New()
            Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
            Me.BorderStyle = BorderStyle.Fixed3D
            Me.BackColor = SystemColors.ControlDarkDark
 
            _Timer = New Timer()
            _Timer.Enabled = False
            _Timer.Interval = 10
            AddHandler _Timer.Tick, AddressOf _Timer_Tick
        End Sub
 
        Private Sub _Timer_Tick(ByVal sender As Object, ByVal e As EventArgs)
            _x += 0.8
 
            If _x > Me.ClientSize.Width Then
                _x = 5
            End If
 
            Me.Invalidate()
        End Sub
 
        Protected Overloads Overrides Sub OnPaint(ByVal e As PaintEventArgs)
            MyBase.OnPaint(e)
 
            Dim y As Integer = CInt(((Me.ClientSize.Height - TextRenderer.MeasureText("W", Me.Font).Height) / 2))
 
            Using brush As New SolidBrush(Me.ForeColor)
                e.Graphics.DrawString(Me.Text, Me.Font, brush, CInt(_x), y)
            End Using
        End Sub
 
        Private _text As String
 
        <Browsable(True)> _
        <DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
        Public Overloads Overrides Property Text() As String
            Get
                Return _text
            End Get
            Set(ByVal value As String)
                _text = value
            End Set
        End Property
 
        <DefaultValue(GetType(Integer), "500")> _
        Public Property Speed() As Integer
            Get
                Return Me._Timer.Interval
            End Get
            Set(ByVal value As Integer)
                Me._Timer.Interval = value
            End Set
        End Property
 
        <Browsable(False)> _
        Public Shadows Property Enabled() As Boolean
            Get
                Return Me._Timer.Enabled
            End Get
            Set(ByVal value As Boolean)
                Me._Timer.Enabled = value
            End Set
        End Property
 
    End Class
 
End Namespace

Open in new window

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month21 days, 1 hour left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question