|
-
Mar 30th, 2006, 08:07 PM
#1
Thread Starter
Hyperactive Member
Listbox mouse XZ not working properly
Hello
I upgraded a VB6 app to .net.
I'm in the process of removing all of the VB namespace stuff to get the app to pure .net.
I have a listbox that allows you to select multiple lines. In the mouse up event the upgrade wizard created these lines:
Code:
Dim Button As Short = eventArgs.Button \ &H100000
Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
Dim x As Single = VB6.PixelsToTwipsX(eventArgs.X)
Dim y As Single = VB6.PixelsToTwipsY(eventArgs.Y)
If I change it to this:
Code:
Dim Button As Short = eventArgs.Button \ &H100000
Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
Dim x As Single = eventArgs.X
Dim y As Single = eventArgs.Y
to remove the VB6 reference the mouse coordinates are not right and it messes everything up.
I've looked around to see of I can find some setting to fix it but I can't see anything that looks like it will help.
Any Ideas?
Thanks
David
Ps: 1 pixel = 15 Twips
-
Mar 30th, 2006, 08:09 PM
#2
Fanatic Member
Re: Listbox mouse XZ not working properly
 Originally Posted by David RH
I'm in the process of removing all of the VB namespace stuff to get the app to pure .net.
Get rid of those twips! , what are you trying to do with the mouse coordinates that's not working?
-
Mar 30th, 2006, 08:15 PM
#3
Thread Starter
Hyperactive Member
Re: Listbox mouse XZ not working properly
I'm trying
I already converted all of the other T to P stuff (control position coordinates and such) and that went well.
The mouse doesn't return the correct coordinates so the wrong item gets selected.
-
Mar 30th, 2006, 08:19 PM
#4
Fanatic Member
Re: Listbox mouse XZ not working properly
I recommend coding from scratch instead of using .net's migrator or you may end up with quite a pile of ****
-
Mar 30th, 2006, 08:29 PM
#5
Re: Listbox mouse XZ not working properly
.NET code works in pixels all the time. If you change the code that uses those 'x' and 'y' variables to use pixels too then there's no issue.
-
Mar 30th, 2006, 08:59 PM
#6
Thread Starter
Hyperactive Member
Re: Listbox mouse XZ not working properly
Now I'm really flummoxed.
The problem started when I messed with those 2 lines. But I did a search and they don't appear to be used anywhere. So I put them back to their previous state and the problem didn't go away. ???
The line of code that it chokes on is:
Code:
If lstSortedLines.SelectedIndex < 7 Then
The error code is:
An unhandled exception of type 'System.IndexOutOfRangeException' occurred in system.windows.forms.dll
Additional information: Index was outside the bounds of the array.
Ideas?
-
Mar 30th, 2006, 09:06 PM
#7
Thread Starter
Hyperactive Member
Re: Listbox mouse XZ not working properly
Say is it possible to have a multi-line item in a listbox?
Example: each list item has a 3 line paragraph of text completely visable.
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
|