Re: yet another owner-drawn CListBox question (problems with custom background patterns)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: AliR (AliR_at_newsgroup.nospam)
Date: 01/19/05


Date: Wed, 19 Jan 2005 18:56:23 GMT

I am just going to point out that I had to do this same thing that you are
doing, and ended up having to right a listbox control from scratch.
The reason is, the way the listbox handles scrolling. If you scroll up then
what it will do is bitblt everything from the first item to the one before
the last one, one line down. And vis versa. So if you repeatedly scroll
down then the background of all the items will become the same. (You can get
around this problem by invalidating the entire listbox everytime there is a
scroll message but it will flicker to death)

Let me know if you want my code that puts a bitmap as the listbox
background.

AliR.

"me" <me@here.com> wrote in message
news:cskm5g$l8u$1@sparta.btinternet.com...
> Does anyone have any experience of trying to render a custom background
> under the contents of an owner-drawn CListBox? I'm experimenting with a
> gradient fill but it could just as easily be a bitmap and what i've
noticed
> is that when the list-box is empty it seems like some kind of internal
> list-box code is executed to erase the list-box scroll area rather than
> going through OnEraseBkgnd (which is where i'm drawing the gradient).
>
> The result is that everything looks fine providing there are some items in
> the list but the instant that the last item is deleted the whole scroll
area
> flashes to white and stays there until some more items are added to the
list
> (whereupon the gradient reappears).
>
> Are there some other messages or callbacks I need to look at?
>
> Regards,
>
> Karl.
>
>



Relevant Pages

  • Re: Using mouse to scroll down a combo list
    ... the ListBox does not have the focus then read on. ... Scroll a ListBox to a specific row. ... the highlight bar up and down, rather than have the laist itself move up ... values, it will show a selection of the one under the pointer, ...
    (microsoft.public.access.forms)
  • Re: Any way to scroll list box left/right propgrammatically?
    ... Private Sub lstAvailable_MouseDown(Button As Integer, Shift As Integer, X As ... horizontal scroll bar is required but it is well behaved in that every column ... in the mouse down event of the listbox. ... Dim intColNumber As Integer, intColWidthSum As Integer ...
    (microsoft.public.access.formscoding)
  • Re: Scroll to specific list box entry
    ... Scroll a ListBox to a specific row. ... Dim intDesiredRow As Integer ... Private Declare Function GetFocus Lib "user32" As Long ...
    (microsoft.public.access.forms)
  • Re: Listbox vertical scroll position capture
    ... so you've got to preserve the scroll location without re-selecting any item in the listbox. ... I don't think I've ever seen any Javascript that can do that, but I'm not a Javascript guru. ... I select from the "Source" list box, add the item to a "Destination" list box and remove the item that was selected from the "Source" listbox. ... How do I scroll as if I am a user scrolling without selecting anything. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Listbox Scroll behaviour ?
    ... Dim Junk As Long ... ..using your ListBox name of course! ... When I scroll down with the slider and reach the bottom I notice that the ... When that happends the scroll bar seems to be ok. ...
    (microsoft.public.access.forms)