dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: VB flicker problem

  1. #1
    Join Date
    Jan 2007
    Posts
    10

    Talking VB flicker problem

    hello,
    i have a little flicker problem, i have a label that i move by 100 px within a timer, but the label flickers when moved. Any solutions to this ?

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Try setting the Label's BackStyle property to 0 (Transparent), and the Form's AutoRedraw property to True and ClipControls property to False.

    You might also try printing text directly onto the form, rather than using a Label control:
    Code:
    Option Explicit
    Private X As Single
    
    Private Sub Form_Load()
        X = 15
    End Sub
    
    Private Sub Timer1_Timer()
    
        Const Message As String = "Hello"
        Dim SaveColor As Long
    
        ' Erase previous message by printing over 
        ' it with the form's background color
        SaveColor = ForeColor
        ForeColor = BackColor
        CurrentX = X
        Me.Print Message;
    
        ' Print the message at the new location
        ForeColor = SaveColor
        X = X + 15
        CurrentX = X
        Me.Print Message;
    
    End Sub
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Jan 2007
    Posts
    10
    10x, Phil Weber, but your example till flickers slightly but still, also tried your advices and none work, i remember an example where the animation should be synced to the refresh of the form, also tried locking the refresh of the window but still the flickering problem remains

  4. #4
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819

    Arrow

    Okey ! , just test my attachment project to know what I meant initially !
    U will know -but unfortunatly without learning: code is off- what I meant by sending your code coz I had an idea and I wanted to upgreat your work to match with it but no luck , the attachment project is an activX ocx only and a test form with it to show the mouvment without flickers .

    p.s. it's very easy and I'm sure any programmer can know the idea easily .
    Attached Files Attached Files
    Last edited by Amahdy; 01-26-2007 at 06:58 PM.
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  5. #5
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    well IF ANY BODY WANT THIS OCX SOURCE CODE:
    first look at my yahoo ID to know my old nickname : "MrJava"
    second make a quick search at www.freevbcode.com
    I sent this ocx code too many years ago, I don't remember a lot information about its condition , but u can find it there with the nickname ByMrJava, and coded with vb5 .
    a quick search there to find the code ...
    ANd as every body know it's not too complicated to make such a trivial ocx , I made it when I was using vb5 , that's mean when I was before 13 Years old .. any NEW-BIE programmer with 10 yo can make such a trivial ocx ... not some thing to hide it from "serious" programmer .
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  6. #6
    Join Date
    Feb 2004
    Location
    Sydney, Australia
    Posts
    498
    Do you want to see the label move, or do you just want to see its new position? If the latter, then set its 'visible' property to false, move it, then set 'visible' to true

  7. #7
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    45
    If you are drawing many things, it may flicker because there is a little delay between the function Cls and all the prints (vb often refresh automaticaly everytime you draw something).
    So, you can draw them into a DIB Section and then use the function BitBlt to copy the built image.
    P.S.: I had the same problem with a progress bar...

Similar Threads

  1. VB 6.0 forms problem
    By deena2209 in forum VB Classic
    Replies: 1
    Last Post: 11-24-2006, 02:24 PM
  2. VB help & complie problem
    By bobbyboy in forum VB Classic
    Replies: 3
    Last Post: 09-10-2005, 06:54 PM
  3. Replies: 1
    Last Post: 02-12-2002, 05:43 PM
  4. The day that everything went wrong!!!
    By WHYVB? in forum .NET
    Replies: 0
    Last Post: 10-03-2001, 09:14 AM
  5. Re: VB or Powerbuilder?
    By Jean-Yves in forum Enterprise
    Replies: 3
    Last Post: 06-01-2000, 12:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center