Click here to Skip to main content
15,886,258 members
Home / Discussions / C#
   

C#

 
GeneralRe: Block Desktop to prevent user interaction Pin
teknolog12312-Oct-10 11:08
teknolog12312-Oct-10 11:08 
QuestionDataBindingComplete Pin
Dewald11-Oct-10 22:54
Dewald11-Oct-10 22:54 
AnswerRe: DataBindingComplete - modified Pin
OriginalGriff11-Oct-10 23:06
mveOriginalGriff11-Oct-10 23:06 
GeneralRe: DataBindingComplete - modified Pin
Dewald11-Oct-10 23:18
Dewald11-Oct-10 23:18 
QuestionInvoke methods in OCX in run time in c# Pin
Viratsaran11-Oct-10 20:16
Viratsaran11-Oct-10 20:16 
AnswerRe: Invoke methods in OCX in c# Pin
Abhinav S11-Oct-10 20:24
Abhinav S11-Oct-10 20:24 
AnswerRe: Invoke methods in OCX in c# Pin
JF201511-Oct-10 21:22
JF201511-Oct-10 21:22 
QuestionListView GetItemAt: problem with point returned Pin
DaveGriffith11-Oct-10 13:27
DaveGriffith11-Oct-10 13:27 
Hi all,

Create a ListView and an ImageList to go with it. Set the following:
Set the ImageList.ImageSize to 250 x 250 in the editor and then add some images - it'll automatically scale them up if you use small images but, for this test, that won't matter at all.
Create a textBox somewhere for the feedback string you're about to get.

Define the ListView as:
ListView1.View=LargeIcon;
ListView1.LargeImageList = ImageList1;
Now create some items for the collection - three is plenty for now - only top level items and don't add any text; you want to show a row of thumbnails to the user, no text or sub-children.

Now, put the following code behind the MouseMove event for the ListView:

// Returns to location of the mouse pointer in the ImageList object
Point cp = ListView1.PointToClient (new Point(e.X, e.Y));

// Report the item that is located under the mousepointer
ListViewItem TheNode = ListView1.GetItemAt(cp.X, cp.Y);
if (TheNode == null)
  {
  textBox1.Text = "nothing";
  return;
  }
textBox1.Text = "item " + TheNode.Index.ToString() + " selected";


My ListView is 1000 wide and not that high (300) so I should get all three items in a horizontal row - and I do - but when I move the mouse around, I'm getting some very bizare feedback from GetItemAt(). In some cases, I get a null until I'm about 50 pixels below a ListItem and when I'm within the bounds of the ListItem image, I'll get a null!

Am I exceptional or is this normal behaviour? If it's normal, anyone know what on earth I can do to mitigate it? My users will be able to define a range of thumbnail sizes and have control over the size of the ListView at runtime.

SysInfo: .NET 4 / VS 2010 / XP SP3 / ex-Pascal hack on keyboard. SysInfo[3] = usual cause of errors Wink | ;-)
AnswerRe: ListView GetItemAt: problem with point returned Pin
Luc Pattyn11-Oct-10 14:05
sitebuilderLuc Pattyn11-Oct-10 14:05 
GeneralRe: ListView GetItemAt: problem with point returned Pin
DaveGriffith11-Oct-10 14:24
DaveGriffith11-Oct-10 14:24 
AnswerRe: ListView GetItemAt: problem with point returned Pin
Luc Pattyn11-Oct-10 14:38
sitebuilderLuc Pattyn11-Oct-10 14:38 
AnswerRe: ListView GetItemAt: problem with point returned Pin
DaveGriffith11-Oct-10 15:04
DaveGriffith11-Oct-10 15:04 
AnswerRe: ListView GetItemAt: problem with point returned Pin
Luc Pattyn11-Oct-10 15:09
sitebuilderLuc Pattyn11-Oct-10 15:09 
QuestionClick Event NaviBar Pin
leocode711-Oct-10 12:32
leocode711-Oct-10 12:32 
Questionreaching textbox in a panel Pin
Erdinc2711-Oct-10 1:06
Erdinc2711-Oct-10 1:06 
AnswerMessage Closed Pin
11-Oct-10 1:19
stancrm11-Oct-10 1:19 
GeneralRe: reaching textbox in a panel Pin
Erdinc2711-Oct-10 1:26
Erdinc2711-Oct-10 1:26 
AnswerRe: reaching textbox in a panel Pin
Pete O'Hanlon11-Oct-10 1:48
mvePete O'Hanlon11-Oct-10 1:48 
GeneralRe: reaching textbox in a panel Pin
Erdinc2711-Oct-10 2:08
Erdinc2711-Oct-10 2:08 
GeneralRe: reaching textbox in a panel Pin
Pete O'Hanlon11-Oct-10 2:40
mvePete O'Hanlon11-Oct-10 2:40 
AnswerRe: reaching textbox in a panel Pin
Luc Pattyn11-Oct-10 1:55
sitebuilderLuc Pattyn11-Oct-10 1:55 
QuestionHow to make a attractive user interface. Pin
R.DileepKumar10-Oct-10 23:26
R.DileepKumar10-Oct-10 23:26 
AnswerRe: How to make a attractive user interface. Pin
Pete O'Hanlon11-Oct-10 0:03
mvePete O'Hanlon11-Oct-10 0:03 
GeneralRe: How to make a attractive user interface. Pin
R.DileepKumar11-Oct-10 18:43
R.DileepKumar11-Oct-10 18:43 
GeneralRe: How to make a attractive user interface. Pin
Nish Nishant12-Oct-10 9:05
sitebuilderNish Nishant12-Oct-10 9:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.