scrolling text / Marque visual studio express /

Posted on 2008-11-05
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
Question by:Amien90
    1 Comment
    LVL 96

    Accepted Solution

    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
            End Sub
            Protected Overloads Overrides Sub OnPaint(ByVal e As PaintEventArgs)
                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
                    Return _text
                End Get
                Set(ByVal value As String)
                    _text = value
                End Set
            End Property
            <DefaultValue(GetType(Integer), "500")> _
            Public Property Speed() As Integer
                    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
                    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


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    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 …
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now