-
Jun 29th, 2020, 07:30 AM
#1
Thread Starter
PowerPoster
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
-
Jun 29th, 2020, 09:22 AM
#2
Re: cover cell in listview
Once again, something you already get with a FlexGrid control: CellLeft, CellTop, CellWidth, CellHeight.
-
Jun 29th, 2020, 11:37 AM
#3
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.
-
Jun 29th, 2020, 03:28 PM
#4
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.
-
Jun 29th, 2020, 10:38 PM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|