Results 1 to 17 of 17

Thread: How to stop the shape from flickering(A Shape control is used)

  1. #1

    Thread Starter
    Hyperactive Member toughcoder's Avatar
    Join Date
    Nov 2002
    Location
    Near, Very Near
    Posts
    340

    How to stop the shape from flickering(A Shape control is used)

    Hello Every1,
    I have a peuliar problem for u guys. Follow closely the code given below......

    Dim x1 As Single, y1 As Single
    Dim draw As Boolean
    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    x1 = X
    y1 = Y
    draw = True
    End Sub

    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If draw = True Then
    Shape1.Left = x1
    Shape1.Top = y1
    Shape1.Width = X - x1
    Shape1.Height = Y - y1
    End If
    End Sub

    Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    draw = False
    End Sub

    The shape sizes according to our mouse, the only problem is the shape flickers. Can any1 stop that flickering. I'll be really happy if any1 can do it for me. Thank u...

    PS: I have tried changing the AutoRedraw & ClipControl options on & off. They dont help...
    If Not VB Then Exit
    ------------------------------------------------
    visit me @ http://mzubair.50g.com/

  2. #2
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Have you tryed to use the move method??? If that don't help you, you may want to use an other method like BitBlt or something...

  3. #3
    Member anjulpa's Avatar
    Join Date
    Aug 2001
    Location
    india
    Posts
    43
    move wont help

    ppl saw this
    Die, ***** Die !

  4. #4
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Then maybe BitBly should be it. More difficult, but probably gets the job done....

  5. #5
    Member anjulpa's Avatar
    Join Date
    Aug 2001
    Location
    india
    Posts
    43
    true

    ppl saw this
    Die, ***** Die !

  6. #6
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    BTW...what are you trying to do. Maybe we can tell you an other way of doing it if you told us what you are trying to do....

  7. #7
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    Originally posted by anjulpa
    move wont help
    move actually is supposed to be faster than assigning the properties one by one.. so if it is flickering because of the speed of the PC (because it doesnt flicker on this p4 2.0 machine) then using .move might help...

  8. #8
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    That was what I thought too....thanks Kleinma for backing me up..

  9. #9
    Member anjulpa's Avatar
    Join Date
    Aug 2001
    Location
    india
    Posts
    43
    move actually is supposed to be faster than assigning the properties one by one.. so if it is flickering because of the speed of the PC (because it doesnt flicker on this p4 2.0 machine) then using .move might help...
    That is but if he's making a game there wont be much of a difference. flickering would reduce but not die out, if using anything less than 1 GHz.

    ppl saw this
    Die, ***** Die !

  10. #10
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    It aslo depends on the size of the shape. But I'm not so sure if he is making a game. I want to here what he is doing...

  11. #11
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Even if it is a game you'll need every bit of speed possible, mind its better if you only have one picture box and bitblt all your images to it rather than having loads of picture boxes, one for each image. Picture boxes like to use lots of memory.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  12. #12
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by Electroman
    Even if it is a game you'll need every bit of speed possible, mind its better if you only have one picture box and bitblt all your images to it rather than having loads of picture boxes, one for each image. Picture boxes like to use lots of memory.
    If you had read his post, you would have seen that he is not using pictureboxes, but a shape. And of course if it is a game, he will need all the speed he can get. It's games that are pushing the PC to it's limit....

  13. #13
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    opps my fault. Mind still sort of applies, if you use a picbox to cover the working area then blt to it, probably only be an advantage if you've got a lot of shapes tho. Even on my PC the shape control flickers tho when you move it (2.5GHz).
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  14. #14
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Yes I know. That is why I asked him to tell us what he was doing, so we maybe could tell him a bether way to do it. So I guess we just have to wait and see....

  15. #15
    Member anjulpa's Avatar
    Join Date
    Aug 2001
    Location
    india
    Posts
    43
    Originally posted by Electroman
    Even if it is a game you'll need every bit of speed possible, mind its better if you only have one picture box and bitblt all your images to it rather than having loads of picture boxes, one for each image. Picture boxes like to use lots of memory.
    In that case better if he uses bitblt and not move for his game .

    ppl saw this
    Die, ***** Die !

  16. #16
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Or DirectX... ...I think we just have to wait and see what he want to accomplish...shall we???

  17. #17
    Member anjulpa's Avatar
    Join Date
    Aug 2001
    Location
    india
    Posts
    43
    lets see, maybe its only a shape that moves, for kids in a kindergarten...lol

    ppl saw this
    Die, ***** Die !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width