dcsimg
Results 1 to 12 of 12

Thread: INSERT image in subitems of lisvtview

Hybrid View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2005
    Location
    Italy-Napoli
    Posts
    1,920

    INSERT image in subitems of lisvtview

    I need to insert a Gif image(is a little image) in subitems of lisview from dir c:\dir1\image.gif, not from imagelist.
    How to?

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,610

    Re: INSERT image in subitems of lisvtview

    Why can't you use the ImageList control?

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2005
    Location
    Italy-Napoli
    Posts
    1,920

    Re: INSERT image in subitems of lisvtview

    Ho bro
    My request is Clear.
    Tks

  4. #4
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,610

    Re: INSERT image in subitems of lisvtview

    Quote Originally Posted by luca90 View Post
    Ho bro
    My request is Clear.
    Tks
    Based on the other replies I say you are out of luck.
    So my question stays and is valid, why can't you use the ImageList control?

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,660

    Re: INSERT image in subitems of lisvtview

    For all I know the broken MSCOMCTL.OCX ImageList still might work if the GIFs all have identical palettes and the same transparent color but I haven't tested that.

    Oddly, if you add GIFs via the designer they'll appear to recognize GIF transparency there but fail at run time. Maybe the flaw is in the ListView, TreeView, etc. instead of in the ImageList?

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,660

    Re: INSERT image in subitems of lisvtview

    See as if the latter is true. ImageList is fine but ListView is broken, and probably TreeView too.

    Name:  sshot.png
Views: 93
Size:  2.6 KB

    The GIFs loaded at run time have differing palettes and transparent colors. They render as expected to PictureBox and Image however.

    Yes, those were meant to be circles but I drew them and got flats on the outside. Just my poor drawing skills.
    Attached Files Attached Files

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,660

    Re: INSERT image in subitems of lisvtview

    You have to use an ImageList. Think of them as part of the ListView, just a part that was factored out of several Common Controls for sharing because they all had similar needs.

    ImageList has a ListImages collection with an Add method. It accepts either bitmap or icon StdPicture objects. They must all have the same height and width.

    When you use LoadPicture() on a GIF the result is a bitmap StdPicture object.

  8. #8
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,514

    Re: INSERT image in subitems of lisvtview

    Can you even put an image in a subitem? Even with the ImageList? I don't think I've ever seen it done. Not saying you can't, but something tells me that it involves making the LV owerdrawn. I know that setting the image index of the item will add the image from the list view to the item, but it appears in the first col.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  9. #9
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,467

    Re: INSERT image in subitems of lisvtview

    @techgnome. Yes, via the ListView.ListItems(x).ListSubItems collection (v6 not v5); also restricted to just report view if I recall.

    Edited: So I don't get flamed a bit. It is likely doable on v5 also, via SendMessage LVM_SETITEM, but not tried it.

    @luca. You can render the GIF over a solid color (same backcolor as your listview), then add that to the imagelist. This can be done at runtime or via PAINT or another graphics tool, saved as a bitmap, and added to the imagelist in design-time.
    Last edited by LaVolpe; May 22nd, 2017 at 02:56 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  10. #10
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,660

    Re: INSERT image in subitems of lisvtview

    The somewhat broken MSCOMCTL.OCX ImageList doesn't handle GIF transparency.

    Is that the issue?

    Didn't occur to me since I hardly ever use MSCOMCTL.OCX anymore. If you can live with the ugliness of those controls you may as well use a FlexGrid and be done with it unless you want to use the various ListView view types. So see post #6 to render a solid image matching the ListView BackColor.

  11. #11

  12. #12
    Super Moderator Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    11,998

    Re: INSERT image in subitems of lisvtview

    I answered a similar question 8 years ago

    Is this what you want?

    http://www.vbforums.com/showthread.p...=1#post3478144
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - 2015 IMP Links : Acceptable Use Policy, FAQ
    MyGear:
    OMEN by HP - 15-ce073tx with Win10+Office 2013. || Mac Book Pro (10.6.8) with Office 2011

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width