About test, can solve, A form, a lsitview (version 6.0) and paste the code below, arbitrarily change the column width, drag the scroll bar at random, and then according to the mouse point to the coordinates calculation of the cell, the results displayed in the window Caption on Option Explicit Private Sub Form_Load () Dim As Integer I ListView1. View=lvwReport ListView1. GridLines=True For I=1 To 20 ListView1. ColumnHeaders. The Add, "col" & amp; I ListView1. ListItems. Add, and "row" & amp; I Next End Sub Private Sub ListView1_MouseMove (Button As an Integer, Shift the As an Integer, As Single x, y As Single) Dim getRow As Long, getCol As Long Dim itmTmp As ListItem The Set itmTmp=ListView1. GetFirstVisible Get the line, first of all get the first display item, the top value is the height of the column head, get rid of the fixed height, 'mouse Y divisible item height is get the mouse pointer to display area which records, coupled with the first line item index, 'is referred to in the current mouse line index GetRow=(y - itmTmp. Top) \ itmTmp Height + itmTmp. Index 'the mouse coordinates X minus the first lines of the left, the abscissa is the most on the left side of the mouse relative to the bank, 'then computed column head width, look at the current point to which a column of GetCol=0 Do GetCol=getCol + 1 X=x - ListView1. ColumnHeaders (getCol). Width Loop Until x & lt; 0 Me. The Caption=getRow & amp; ", "& amp; GetCol End Sub CodePudding user response:
Write a line leakage, changing the Option Explicit Private Sub Form_Load () Dim As Integer I ListView1. View=lvwReport ListView1. GridLines=True For I=1 To 20 ListView1. ColumnHeaders. The Add, "col" & amp; I ListView1. ListItems. Add, and "row" & amp; I Next End Sub Private Sub ListView1_MouseMove (Button As an Integer, Shift the As an Integer, As Single x, y As Single) Dim getRow As Long, getCol As Long Dim itmTmp As ListItem The Set itmTmp=ListView1. GetFirstVisible Get the line, first of all get the first display item, the top value is the height of the column head, get rid of the fixed height, 'mouse Y divisible item height is get the mouse pointer to display area which records, coupled with the first line item index, 'is referred to in the current mouse line index GetRow=(y - itmTmp. Top) \ itmTmp Height + itmTmp. Index 'the mouse coordinates X minus the first lines of the left, the abscissa is the most on the left side of the mouse relative to the bank, 'then computed column head width, look at the current point to which a column of GetCol=0 X=x - itmTmp. Left Do GetCol=getCol + 1 X=x - ListView1. ColumnHeaders (getCol). Width Loop Until x & lt; 0 Me. The Caption=getRow & amp; ", "& amp; GetCol End Sub CodePudding user response:
No empty listview and the row and col without hold full display area for processing, too lazy to write, and their control is a little judgment, CodePudding user response:
reference crispy, 9/f, big ice cream reply: not for listview and empty row and col hold full display area not handled well, too lazy to write, our judgment with control is, Is not supported by the things you want him support, Laborious still not feel well, Each control has he is good at the place,nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull