 |
|
|
|
| Author |
Message |
David
Joined: 08 Aug 2007 Posts: 7
|
Posted: Thu Jan 31, 2008 7:49 pm Post subject: Mouse selection |
|
|
Hi all,
I have a picturebox control, that I am dynamically generating a graph of
points (vector drawing).
Now, what I need to do is when I hold my pointer on a plotted point (or
within a specified radius), I want to pop-up certain information about the
point. You know, like the circle that spins up and looks like a right
click... I want to be able to do something like this.
Any pointers would be appreciated.
Thanks.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
Archived from group: microsoft>public>dotnet>framework>compactframework |
|
| Back to top |
|
 |
dbgrick
Joined: 08 Aug 2007 Posts: 48
|
Posted: Thu Jan 31, 2008 12:29 pm Post subject: RE: Mouse selection |
|
|
The picturebox has a MouseDown event handler. Wire up the MouseDown event
handler and then use the x and y coordinates in the MouseEventArgs to
determine the location of the stylus on the graph. Then you create a form
that contains the info and show it to the user.
Regards,
Rick D.
"David" wrote:
> Hi all,
>
> I have a picturebox control, that I am dynamically generating a graph of
> points (vector drawing).
>
> Now, what I need to do is when I hold my pointer on a plotted point (or
> within a specified radius), I want to pop-up certain information about the
> point. You know, like the circle that spins up and looks like a right
> click... I want to be able to do something like this.
>
> Any pointers would be appreciated.
>
> Thanks.
> --
> Best regards,
> Dave Colliver.
> http://www.AshfieldFOCUS.com
> ~~
> http://www.FOCUSPortals.com - Local franchises available
>
>
> |
|
| Back to top |
|
 |
David
Joined: 08 Aug 2007 Posts: 7
|
Posted: Thu Jan 31, 2008 8:36 pm Post subject: Re: Mouse selection |
|
|
Thank you, I was considering this route already, but what I would have
preferred is a 'context sensitive' type of pop-up. Basically, hold the
pointer down, get the dots rotating around the pointer and pop-up my
information.
Also on this pop-up I would also like to have a menu item that is possible
to delete the point that I have plotted.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"dbgrick" wrote in message @microsoft.com...
> The picturebox has a MouseDown event handler. Wire up the MouseDown event
> handler and then use the x and y coordinates in the MouseEventArgs to
> determine the location of the stylus on the graph. Then you create a
> form
> that contains the info and show it to the user.
>
> Regards,
> Rick D.
>
> "David" wrote:
>
>> Hi all,
>>
>> I have a picturebox control, that I am dynamically generating a graph of
>> points (vector drawing).
>>
>> Now, what I need to do is when I hold my pointer on a plotted point (or
>> within a specified radius), I want to pop-up certain information about
>> the
>> point. You know, like the circle that spins up and looks like a right
>> click... I want to be able to do something like this.
>>
>> Any pointers would be appreciated.
>>
>> Thanks.
>> --
>> Best regards,
>> Dave Colliver.
>> http://www.AshfieldFOCUS.com
>> ~~
>> http://www.FOCUSPortals.com - Local franchises available
>>
>>
>> |
|
| Back to top |
|
 |
Paul G. Tobey [eMVP]
Joined: 08 Aug 2007 Posts: 185
|
Posted: Thu Jan 31, 2008 1:51 pm Post subject: Re: Mouse selection |
|
|
Look up "context menu tap and hold" in the archives of this group:
http://groups.google.com/group/microsoft.public.dotnet.framework.compactframework/topics?hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8
Paul T.
"David" wrote in message @TK2MSFTNGP04.phx.gbl...
> Thank you, I was considering this route already, but what I would have
> preferred is a 'context sensitive' type of pop-up. Basically, hold the
> pointer down, get the dots rotating around the pointer and pop-up my
> information.
>
> Also on this pop-up I would also like to have a menu item that is possible
> to delete the point that I have plotted.
>
>
> --
> Best regards,
> Dave Colliver.
> http://www.AshfieldFOCUS.com
> ~~
> http://www.FOCUSPortals.com - Local franchises available
> "dbgrick" wrote in message
> @microsoft.com...
>> The picturebox has a MouseDown event handler. Wire up the MouseDown
>> event
>> handler and then use the x and y coordinates in the MouseEventArgs to
>> determine the location of the stylus on the graph. Then you create a
>> form
>> that contains the info and show it to the user.
>>
>> Regards,
>> Rick D.
>>
>> "David" wrote:
>>
>>> Hi all,
>>>
>>> I have a picturebox control, that I am dynamically generating a graph of
>>> points (vector drawing).
>>>
>>> Now, what I need to do is when I hold my pointer on a plotted point (or
>>> within a specified radius), I want to pop-up certain information about
>>> the
>>> point. You know, like the circle that spins up and looks like a right
>>> click... I want to be able to do something like this.
>>>
>>> Any pointers would be appreciated.
>>>
>>> Thanks.
>>> --
>>> Best regards,
>>> Dave Colliver.
>>> http://www.AshfieldFOCUS.com
>>> ~~
>>> http://www.FOCUSPortals.com - Local franchises available
>>>
>>>
>>>
>
> |
|
| Back to top |
|
 |
David
Joined: 08 Aug 2007 Posts: 7
|
Posted: Thu Jan 31, 2008 9:20 pm Post subject: Re: Mouse selection |
|
|
Thanks, I have found it...
I am now calculating the position of the mouse in the picturebox, but have
some slight problems.
PopupMenu.MenuItems.Clear();
MenuItem XPos = new MenuItem();
XPos.Text = "X : " + (MousePosition.X - GraphDisplay.Location.X);
MenuItem YPos = new MenuItem();
YPos.Text = "Y : " + (MousePosition.Y - GraphDisplay.Location.Y);
PopupMenu.MenuItems.Add(XPos);
PopupMenu.MenuItems.Add(YPos);
(My picturebox is called GraphDisplay).
I am trying to get the coordinates with reference to top left of picture
box, The X Position is perfect, the top position (Y) looks like it is taking
into account the title area (where the start button etc. is).
Is the title bar height consistent? How high is it? (Looking for "Start menu
height" on google doesn't show anything.)
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"Paul G. Tobey [eMVP]"
com> wrote in message @TK2MSFTNGP03.phx.gbl...
> Look up "context menu tap and hold" in the archives of this group:
>
> http://groups.google.com/group/microsoft.public.dotnet.framework.compactframework/topics?hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8
>
> Paul T.
>
> "David" wrote in message
> @TK2MSFTNGP04.phx.gbl...
>> Thank you, I was considering this route already, but what I would have
>> preferred is a 'context sensitive' type of pop-up. Basically, hold the
>> pointer down, get the dots rotating around the pointer and pop-up my
>> information.
>>
>> Also on this pop-up I would also like to have a menu item that is
>> possible to delete the point that I have plotted.
>>
>>
>> --
>> Best regards,
>> Dave Colliver.
>> http://www.AshfieldFOCUS.com
>> ~~
>> http://www.FOCUSPortals.com - Local franchises available
>> "dbgrick" wrote in message
>> @microsoft.com...
>>> The picturebox has a MouseDown event handler. Wire up the MouseDown
>>> event
>>> handler and then use the x and y coordinates in the MouseEventArgs to
>>> determine the location of the stylus on the graph. Then you create a
>>> form
>>> that contains the info and show it to the user.
>>>
>>> Regards,
>>> Rick D.
>>>
>>> "David" wrote:
>>>
>>>> Hi all,
>>>>
>>>> I have a picturebox control, that I am dynamically generating a graph
>>>> of
>>>> points (vector drawing).
>>>>
>>>> Now, what I need to do is when I hold my pointer on a plotted point (or
>>>> within a specified radius), I want to pop-up certain information about
>>>> the
>>>> point. You know, like the circle that spins up and looks like a right
>>>> click... I want to be able to do something like this.
>>>>
>>>> Any pointers would be appreciated.
>>>>
>>>> Thanks.
>>>> --
>>>> Best regards,
>>>> Dave Colliver.
>>>> http://www.AshfieldFOCUS.com
>>>> ~~
>>>> http://www.FOCUSPortals.com - Local franchises available
>>>>
>>>>
>>>>
>>
>>
>
> |
|
| Back to top |
|
 |
Christopher Fairbairn
Joined: 08 Aug 2007 Posts: 19
|
Posted: Fri Feb 01, 2008 2:59 pm Post subject: Re: Mouse selection |
|
|
Hi,
"David" wrote in message @TK2MSFTNGP06.phx.gbl...
> I am trying to get the coordinates with reference to top left of picture
> box, The X Position is perfect, the top position (Y) looks like it is
> taking into account the title area (where the start button etc. is).
>
> Is the title bar height consistent? How high is it? (Looking for "Start
> menu height" on google doesn't show anything.)
Instead of trying to perform this kind of calculation manually take a look
at the PointToClient method available on the picture box control (see MSDN
documentation at
http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.pointtoclient.aspx).
// Convert co-ordinates from screen space to client space.
Point pt = pictureBox1.PointToClient(new Point(MousePosition));
This will take a point measured in screen co-ordinates (such as the mouse
position) and perform the transformation required to convert it into client
co-ordinates (i.e. relative to the picture box).
Your X co-ordinate is probably looking correct due to it being a Windows
Mobile device where windows are fullscreen by default and hence the offset
between screen co-ordinates and form co-ordinates is zero on the x axis. If
your dialog was non fullscreen or running on a Windows CE device etc this
may not be the case.
Hope this helps,
Christopher Fairbairn |
|
| Back to top |
|
 |
David
Joined: 08 Aug 2007 Posts: 7
|
Posted: Fri Feb 01, 2008 5:00 pm Post subject: Re: Mouse selection |
|
|
Thank you.
I currently have it working with the way I had written here, but I will
definately look at the PointToClient. That sounds a much more scalable way
of handling it (especially if I move or resize the picturebox (actually, the
way I have currently done it is mathematically using top, left, width and
height etc.))
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"Christopher Fairbairn" wrote in message @microsoft.com...
> Hi,
>
> "David" wrote in message
> @TK2MSFTNGP06.phx.gbl...
>> I am trying to get the coordinates with reference to top left of picture
>> box, The X Position is perfect, the top position (Y) looks like it is
>> taking into account the title area (where the start button etc. is).
>>
>> Is the title bar height consistent? How high is it? (Looking for "Start
>> menu height" on google doesn't show anything.)
>
> Instead of trying to perform this kind of calculation manually take a look
> at the PointToClient method available on the picture box control (see MSDN
> documentation at
> http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.pointtoclient.aspx).
>
> // Convert co-ordinates from screen space to client space.
> Point pt = pictureBox1.PointToClient(new Point(MousePosition));
>
> This will take a point measured in screen co-ordinates (such as the mouse
> position) and perform the transformation required to convert it into
> client co-ordinates (i.e. relative to the picture box).
>
> Your X co-ordinate is probably looking correct due to it being a Windows
> Mobile device where windows are fullscreen by default and hence the offset
> between screen co-ordinates and form co-ordinates is zero on the x axis.
> If your dialog was non fullscreen or running on a Windows CE device etc
> this may not be the case.
>
> Hope this helps,
> Christopher Fairbairn |
|
| Back to top |
|
 |
David
Joined: 08 Aug 2007 Posts: 7
|
Posted: Sat Feb 02, 2008 3:06 pm Post subject: Re: Mouse selection |
|
|
Excellent. Works beautifully. Thank you.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"Christopher Fairbairn" wrote in message @microsoft.com...
> Hi,
>
> "David" wrote in message
> @TK2MSFTNGP06.phx.gbl...
>> I am trying to get the coordinates with reference to top left of picture
>> box, The X Position is perfect, the top position (Y) looks like it is
>> taking into account the title area (where the start button etc. is).
>>
>> Is the title bar height consistent? How high is it? (Looking for "Start
>> menu height" on google doesn't show anything.)
>
> Instead of trying to perform this kind of calculation manually take a look
> at the PointToClient method available on the picture box control (see MSDN
> documentation at
> http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.pointtoclient.aspx).
>
> // Convert co-ordinates from screen space to client space.
> Point pt = pictureBox1.PointToClient(new Point(MousePosition));
>
> This will take a point measured in screen co-ordinates (such as the mouse
> position) and perform the transformation required to convert it into
> client co-ordinates (i.e. relative to the picture box).
>
> Your X co-ordinate is probably looking correct due to it being a Windows
> Mobile device where windows are fullscreen by default and hence the offset
> between screen co-ordinates and form co-ordinates is zero on the x axis.
> If your dialog was non fullscreen or running on a Windows CE device etc
> this may not be the case.
>
> Hope this helps,
> Christopher Fairbairn
|
|
| Back to top |
|
 |
|
|
| Related Topics: | Problem with selection list ! I have a file .aspx with four forms. In the second form i have a selection list, and items of this selection list are a "particular" (see the code below) Public Class Inherits Public Pro
Multiple selection for a listbox Hi all, I am using Framework 1.1, XP, VS2003. I am having a problem with selecting multiple rows in a listbox object SetSelected() method selects one an unselects the previously selected item. and SelectedItems collection
selection color of ListView is there a way to set the selection color of list view item? The default behaviour is: the selection color is blue when the item has focus and black when it does not? Is there a way to change/set these colours? Thanx All!
multiple selection in listbox I would like to select and use multiple records in a listbox . Is this possible? I use ASP.NET 2.0, VS2005 -- regards, Arvid
ComboBox : manually update text on list item selection I have a dropdown style combobox containing : 01 - USA 31 - Holland 33 - France 41 - Switzerland When a user selects a list item I'd like to display only the number in the textbox part of the comboBox. So if "01 - USA" is selected only "01" should be disp |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|