Results 1 to 5 of 5

Thread: cover cell in listview

  1. #1

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

    cover cell in listview

    I have a picturebox on form.

    now with comandclick event i need to insert the picturebox in row 4 of column 7 of listview1.
    How to?

    Naturally autosize the picturebox based the dimension of cell in listview1.

    In effect i need to cover the cell with picturebox

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    21,089

    Re: cover cell in listview

    Once again, something you already get with a FlexGrid control: CellLeft, CellTop, CellWidth, CellHeight.

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,104

    Re: cover cell in listview

    You can use SendMessage with LVM_GETITEMRECT (search forum for this). There are plenty of examples of overlaying a picturebox and other controls on a listview. It gets even more complex when that overlay is visible and one rolls the mouse wheel.
    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}

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    21,089

    Re: cover cell in listview

    There is also the issue of the user changing views. The main reason for the ListView control is multiple views.

  5. #5
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,533

    Re: cover cell in listview

    Most other modes won't have columns, so you wouldn't have a valid rect to display it in at all. If the view is changed to Tile or Extended Tile (like Contents in Explorer), the proper rect is returned for each subitem displayed. More of a problem is the scrolling. You can look at a control such as ucListViewEx, various versions show different techniques for placing a control as a ListView subitem if you search around. My shell browser control has 2 entirely different methods others have developed for overlays in subitems (one where you paint it yourself and two where you position controls by hWnd), but it's not exactly an easy read, really need to rewrite it sometime. Group view causes additional problems if you're supporting it, but that's probably not relevant here (it returns seemingly valid rects based on where an item would be if the group wasn't collapsed, when the group is, so if you don't account for that you have controls for invisible items overlapping the visible items).

    I still can't get native subitem controls to work, they'll draw once on mouseover then disappear or just crash, VB just doesn't seem capable of handling the required calls that work fine in other languages

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