Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi everyone,
I am working with VitaminCtrl in IP Camera Project. Now I have a problem that: I want to handle "right mouse click" event to show menu (like window media player). VitaminCtrl has a attribute is "BeRightClickHandler", I were set it is true and when running, it always show "Joystick Settings" menu and I can not customize it, and I can not handle "right click" event of VitaminCtrl.

My question is how to handle "right click" event of VitaminCtrl? Can I customize menu "Joystick Settings"? Please give me solution for it.

Thanks in advance!
Posted

1 solution

I suggest you contact the vendor to get help. They are going to know their control the best and how to accomplish what you want to do.

Failing that....

- you might be able to subclass their control and override the OnRightMouseButtonPress method. That assumes their control derives from the base windows control class and they haven't sealed it. Just replace their control in your projectwith your new, extended control.

- you could position an invisible control over the vitaminctrl to capture the mouse events. If there is no left-click requirement, this would actually be really easy in winforms, wpf, silverlight, or WinRT.
 
Share this answer
 
Comments
Tuyển Đỗ 26-Jun-13 0:32am    
Hi Jason Gleim,
Can you make clear about second suggess? (you could position an invisible control over the vitaminctrl to capture the mouse events. If there is no left-click requirement, this would actually be really easy in winforms, wpf, silverlight, or WinRT.)

Thank you very much.
Jason Gleim 26-Jun-13 0:50am    
How you do it is dependent on the app technology. Winforms is different than the xaml-based stuff but the gist is the same. You position a container control, like a panel, over the VitaminCtrl and set the width/height to match. You set the background of the control to #00ffffff which makes it invisible. The user can't see the overlaid control but when they right-click, the event will be routed to the overlay control....not the underlying VitaminCtrl. Just make sure you set e.handled=true in the event handler or else the right-click will bubble up the event chain and trigger the joystick menu too.

Hope that helps!
Permalink
Tuyển Đỗ 26-Jun-13 2:09am    
I understood your solution, and now I will try to set a control over VitaminCtrl. But I was ever try to set a Label on the background (add new label to VItaminCtrl) of VitaminCtrl and when Full-Screem mode, Label was hidden. I am afraid your solution may not success when VitaminCtrl in Full-Screen Mode.

Thank you very much. I'm listening your advice.
Tuyển Đỗ 26-Jun-13 2:22am    
Hi Jason Gleim
I was try it but not success. When normal mode, it worjing ok, but in Full-screen mode it does not working.
Jason Gleim 26-Jun-13 9:48am    
The VitaminCtrl control is likely changing it's size and bringing itself to the top of the z-order when in full-screen mode. You may have to hook the resize event on the VitaminCtrl and use it to resize the overlay as well.. You may also need to set the z-order of the overlay control so it is always topmost. Both can be done in that resize event handler. Just make sure you call the base event handler for the VitaminCtrl first so that the control resizes then you should be able to get the new length & height values to set the overlay control.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900