3 Replies - 1522 Views - Last Post: 18 January 2013 - 10:51 AM Rate Topic: -----

#1 dullard  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 18-January 13

How to set the contextmenustrip submenu cursor

Posted 18 January 2013 - 10:09 AM

I'm trying to upgrade a Windows application from VB6 to VB2010 Express. So, I am still quite a beginner in .NET style code.

I want a context menu strip that has a custom cursor. So far, I have found a partial solution. I imported a custom icon (named CustomCursor) as an icon into My.Resources. Then I used this code:
ContextMenuStrip1.Cursor = New Cursor(My.Resources.CustomCursor.Handle)


That part works perfectly. I can change the cursor in ContextMenuStrip1 to anything I want. But the problem comes with submenus. The ContextMenuStrip1 has a collection of ten ToolStripMenuItems in Items. Each of those ToolStripMenuItem opens a submenu of its own collection of ten different ToolStripMenuItems in DropDownItems. No matter what I've tried, the main menu in ContextMenuStrip1 has the custom cursor but the submenus revert to the default cursor.

I've also tried setting Me.Cursor to the custom cursor. Then everything has the custom cursor, except for the submenus.

Is there a way to set the submenu cursor? Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: How to set the contextmenustrip submenu cursor

#2 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3730
  • View blog
  • Posts: 13,024
  • Joined: 12-December 12

Re: How to set the contextmenustrip submenu cursor

Posted 18 January 2013 - 10:23 AM

As far as I can tell a ToolStripMenuItems, or the combo-boxes or text-boxes within it, do not have a Cursor property.

I suppose it might be possible to create it using the Win-API, or methods of the .NET Framework, but I think it would be a challenge.

BTW Such a menu system seems overboard :helpsmilie: to me: I don't think I could navigate it without drifting outside the menus.

This post has been edited by andrewsw: 18 January 2013 - 10:26 AM

Was This Post Helpful? 0
  • +
  • -

#3 dullard  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 18-January 13

Re: How to set the contextmenustrip submenu cursor

Posted 18 January 2013 - 10:34 AM

View Postandrewsw, on 18 January 2013 - 10:23 AM, said:

As far as I can tell a ToolStripMenuItems, or the combo-boxes or text-boxes within it, do not have a Cursor property.

I suppose it might be possible to create it using the Win-API, or methods of the .NET Framework, but I think it would be a challenge.

BTW Such a menu system seems overboard :helpsmilie:/> to me: I don't think I could navigate it without drifting outside the menus.

Thank you for answering. At every turn, VB.NET seems to take something extremely easy to code /read in VB6 and turn it into something that would be quite a challenge and requires at least 100 times as much code.

I don't think the menu system is that difficult. The VB2010 Express File menu has 15 main items and several of those has 10 submenu items. So, mine is not any more difficult than a typical program's menu.
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3730
  • View blog
  • Posts: 13,024
  • Joined: 12-December 12

Re: How to set the contextmenustrip submenu cursor

Posted 18 January 2013 - 10:51 AM

Quote

I don't think the menu system is that difficult. The VB2010 Express File menu has 15 main items and several of those has 10 submenu items. So, mine is not any more difficult than a typical program's menu.


Yours is a context-menu and some people have difficulty alternating between the right and left-mouse; some also have difficulty using the right-mouse button. But you probably already have main menu options and shortcut alternatives.

I apologise in advance as you probably know these already: when you add controls such as a ContextMenuStrip you can click the little arrow (Tasks button) to build and customize it, before adding code. In the Properties Window you can double-click an Event to create a procedure-stub for it.

This post has been edited by andrewsw: 18 January 2013 - 10:56 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1