Results 1 to 7 of 7

Thread: vb.net 2003: trying to speed up an owner-drawn listbox

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662

    Re: vb.net 2003: trying to speed up an owner-drawn listbox

    Quote Originally Posted by The Dutch Dude
    <shot in the dark>
    maybe using BeginUpdate and EndUpdate will help to reduce the flickering?
    </shot in the dark>
    Actually, that increased the flickering to a horrible level whereas it's just bad now.

    The way I had coded it was also pretty bad. To make it compatible with the way I intend to do things now, I have to re-write the code for that and in doing so, I'm going to double-buffer the whole thing to see if that works.

  2. #2
    Hyperactive Member The Dutch Dude's Avatar
    Join Date
    Nov 2001
    Location
    Holland. Land of the Dutch. Home for me.
    Posts
    261

    Re: vb.net 2003: trying to speed up an owner-drawn listbox

    Weird... BeginUpdate should stop the listbox from doing anything and display utterly nothing, a grey mass at the most, but it should not flicker. But I'll be interested to hear how this is solved..
    Obey the dragon thing. Or not. Or possibly just a bit.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662

    Re: vb.net 2003: trying to speed up an owner-drawn listbox

    its mainly because the EndUpdate causes the whole thing to be re-drawn which causes all of the items to be redrawn. It doesn't call the drawitem event, but it does BeginUpdate...EndUpdate each time a new item is added or otherwise drawn.

  4. #4
    Hyperactive Member The Dutch Dude's Avatar
    Join Date
    Nov 2001
    Location
    Holland. Land of the Dutch. Home for me.
    Posts
    261

    Re: vb.net 2003: trying to speed up an owner-drawn listbox

    Ah, right, BeginUpdate should be placed before and EndUpdate should be placed after any adding takes place, then it should only redraw once, which is the point of the 2 methods, to stop the redrawing when an item is added.
    So:

    VB Code:
    1. myBootaliciousListBox.BeginUpdate()
    2.  
    3. ' example loop
    4. while somethingOrOther
    5.   myBootaliciousListBox.Items.Add(New ColorListItem("Text", Drawing.Color.Red)
    6. end while
    7.  
    8. myBootaliciousListBox.EndUpdate()
    Obey the dragon thing. Or not. Or possibly just a bit.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662

    Re: vb.net 2003: trying to speed up an owner-drawn listbox

    I'll give that a try...

    Quote Originally Posted by The Dutch Dude
    Ah, right, BeginUpdate should be placed before and EndUpdate should be placed after any adding takes place, then it should only redraw once, which is the point of the 2 methods, to stop the redrawing when an item is added.
    So:

    VB Code:
    1. myBootaliciousListBox.BeginUpdate()
    2.  
    3. ' example loop
    4. while somethingOrOther
    5.   myBootaliciousListBox.Items.Add(New ColorListItem("Text", Drawing.Color.Red)
    6. end while
    7.  
    8. myBootaliciousListBox.EndUpdate()

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