Results 1 to 7 of 7

Thread: [RESOLVED] Krool -Listview How to set Backcolor or a row & Bug in Picture property ?

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2021
    Posts
    46

    Resolved [RESOLVED] Krool -Listview How to set Backcolor or a row & Bug in Picture property ?

    Hello everyone,

    I posted my request earlier in this thread. Post #8

    @SamOscarBrown
    Thank you.
    I am so happy to become a member of this community. As suggested by you, I am starting this new thread.

    My requirement:
    I want to be able to set the backcolor of any row in a ListBOX. A Listview is actually an overkill for me.

    I found this interesting article about just that. Scroll down to the very bottom and you will find what exactly I am looking for.

    Surprisingly, the download link for the example code is also still active. I tried it out. It works just as it says but that's it. You try tinkering anything with it, it hangs.

    Then I found this https://www.vbforums.com/showthread....t-subclassing) suggested in #4

    This is a beauty. It works well. But I can't use it because it doesn't work with Krool's Listview.

    I like to use Krool's controls in order to make a single executable without any dependencies.

    Apparently, there is a bug in the Picture property of Krool's Lisview, or I am missing something. Because, that is where the code in the above example, fails.
    When you execute
    Code:
    kroolListview.picture = picbg.image
    , nothing happens. I tried various other ways of assigning the picture. Still nothing.

    Then I found, even when you assign a picture at design time, it does not work.
    I tried setting the PictureWatermark property = True. That also doesn't work.

    You can see the difference at Design time. I have assigned the same picture to both MS Listview (top) and Krool's Listview (bottom).
    Name:  krool.jpg
Views: 332
Size:  26.8 KB

    So, I am pinning my hopes on the method suggested by Krool, in #5.
    Re: listview row color
    You could take the ListView control from my CommonControls replacement project.
    Click here.

    It supports a BackColor (via the "ItemBkColor" event) for the ListItems. (and many other features more)
    I have absolutely no idea how to use achieve that.

    Over to you all, for your suggestions.

    Thanks.

  2. #2
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: Krool -Listview How to set Backcolor or a row & Bug in Picture property ?

    Quote Originally Posted by Yakkov View Post
    Hello everyone,

    I posted my request earlier in this thread. Post #8

    @SamOscarBrown
    Thank you.
    I am so happy to become a member of this community. As suggested by you, I am starting this new thread.

    My requirement:
    I want to be able to set the backcolor of any row in a ListBOX. A Listview is actually an overkill for me.

    I found this interesting article about just that. Scroll down to the very bottom and you will find what exactly I am looking for.

    Surprisingly, the download link for the example code is also still active. I tried it out. It works just as it says but that's it. You try tinkering anything with it, it hangs.

    Then I found this https://www.vbforums.com/showthread....t-subclassing) suggested in #4

    This is a beauty. It works well. But I can't use it because it doesn't work with Krool's Listview.

    I like to use Krool's controls in order to make a single executable without any dependencies.

    Apparently, there is a bug in the Picture property of Krool's Lisview, or I am missing something. Because, that is where the code in the above example, fails.
    When you execute
    Code:
    kroolListview.picture = picbg.image
    , nothing happens. I tried various other ways of assigning the picture. Still nothing.

    Then I found, even when you assign a picture at design time, it does not work.
    I tried setting the PictureWatermark property = True. That also doesn't work.

    You can see the difference at Design time. I have assigned the same picture to both MS Listview (top) and Krool's Listview (bottom).
    Name:  krool.jpg
Views: 332
Size:  26.8 KB
    Not a bug in the Picture property.
    The description says:
    "Returns/sets the background picture. Requires comctl32.dll version 6.0 or higher."

    So it is a limitation in the SysListView32 that your app needs a manifest. (Known as themed controls for simplicity explanation)

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2021
    Posts
    46

    Re: Krool -Listview How to set Backcolor or a row & Bug in Picture property ?

    @Krool
    Thank you for the clarification.
    I am so delighted to receive the reply from the Master himself.

    Would you also please help me with my main problem; i.e., using the "ItemBkColor" event to set the BackColor of the row?

    Regards,

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2021
    Posts
    46

    Re: Krool -Listview How to set Backcolor or a row & Bug in Picture property ?

    Quote Originally Posted by Krool View Post
    Not a bug in the Picture property.
    The description says:
    "Returns/sets the background picture. Requires comctl32.dll version 6.0 or higher."
    I am sorry, I am new to VB. I thought that meant adding it in Project ->Reference.
    I didn't find comctl32.dll in the list. I browsed to SysWOW64 and pointed to comctl32.dll.
    That resulted in Error "can't add a reference to a specified file."
    Can someone guide me how to get the Picture property working, please?

    Thanks

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2021
    Posts
    46

    Re: Krool -Listview How to set Backcolor or a row & Bug in Picture property ?

    Quote Originally Posted by Krool View Post
    Not a bug in the Picture property.
    The description says:
    "Returns/sets the background picture. Requires comctl32.dll version 6.0 or higher."

    So it is a limitation in the SysListView32 that your app needs a manifest. (Known as themed controls for simplicity explanation)
    I went through various forum posts on this topic of using a manifest and using a RES file (instead of the manifest), naming it as 24, etc
    I found that the Standard Controls Demo Project already has this Res file (manifest) and the Startup.bas meets all the requirements.
    So, technically, if I use that demo project and if I just set the picture property of a Listview control in that project, at Design time, the picture should show up.

    But it doesn't.
    What else needs to be done?

    Any clues?

  6. #6
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: Krool -Listview How to set Backcolor or a row & Bug in Picture property ?

    Quote Originally Posted by Yakkov View Post
    I went through various forum posts on this topic of using a manifest and using a RES file (instead of the manifest), naming it as 24, etc
    I found that the Standard Controls Demo Project already has this Res file (manifest) and the Startup.bas meets all the requirements.
    So, technically, if I use that demo project and if I just set the picture property of a Listview control in that project, at Design time, the picture should show up.

    But it doesn't.
    What else needs to be done?

    Any clues?
    The RES will manifest the compiled App. If you want the IDE manifested you need to make a manifest for VB6.exe

  7. #7

    Thread Starter
    Member
    Join Date
    Jan 2021
    Posts
    46

    [RESOLVED] Krool -Listview How to set Backcolor or a row & Bug in Picture property ?

    @Krool
    Thank you very much.
    So, that was the clue!

    The picture does not appear at design time, in IDE; but it does, when you run the compiled Exe.

    In the Listview of Comctl32, it appears in IDE itself. That's where I got mislead.

    Regards.

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