Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / December 2006

Tip: Looking for answers? Try searching our database.

Question about ListViewItem and ListViewSubItem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JimCinLA - 10 Dec 2006 20:50 GMT
In a ListView with ID = myListView
I use in a C# Windows project, I have two columns,
and about a dozen rows, i.e., members of the ListViews Items
collection.

In determining whether a mouse was clicked inside the second
row, right column, I compute the bounding rectangle

 Rectangle row2col2 = myListView.Items[1].SubItems[0].Bounds

and then check if the point returned by MouseEventsArg
falls inside the rectangle.

But for some reason, the test seems to pass whether I click in either
column, which in my case is undesired behavior.  I want the test
to pass only when the right column, i.e., the one with SubItems[0].
is clicked.

Any idea what I'm doing wrong?

The motivation for the question is that I populate the SubItem
with a ComboBox.  It works, but I don't want the ComboBox
to be available when the user clicks in an adjacent column.

I'm using the MouseUp event by the way, but I don't
think that's relevant.
Jeff Gaines - 10 Dec 2006 21:10 GMT
On 10/12/2006 in message

>In determining whether a mouse was clicked inside the second
>row, right column, I compute the bounding rectangle
[quoted text clipped - 3 lines]
>and then check if the point returned by MouseEventsArg
>falls inside the rectangle.

Isn't SubItems[0] the ListViewItem itself? I *think* SubItem indexing
starts at 1 for the first sub item. I suspect you are getting the ItemRect
for the whole LVItem.

Signature

Jeff Gaines
Damerham Hampshire UK


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.