owner drawn contextmenu

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • EvilProject
    New Member
    • Nov 2007
    • 16

    owner drawn contextmenu

    Hi , Im working on an owner drawn context menu.
    I want to replace the regular submenu arrow with my own arrow,I went threw all the properties and overridable methods of menuitem and couldn't find a way to do that.Is it imposiable to make that arrow disapear so i could replace it ?

    thanks in advance.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    you might need to use some third party control for the purpose.

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Don't forget, through various Windows API calls there are numerous ways in which you can change the look of menu items, even placing pictures in the menu and so on. It's difficult to believe there isn't some way to achieve what you want through a similar mechanism. As well as "owner drawn" I seem to recall the term "subclassin g" being used in connection with this. Perhaps some searching on this will help

      On the other hand, changing such a fundamental part of the Windows interface might be a really bad idea.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        I did a search on Google for "vb subclass menu". As always, of course, there were far too many results to even think about. But here were a couple that I thought sounded relevant, at first glance...

        Comment

        • EvilProject
          New Member
          • Nov 2007
          • 16

          #5
          first thing , thanks everybody for answering.

          Originally posted by Killer42
          I did a search on Google for "vb subclass menu". As always, of course, there were far too many results to even think about. But here were a couple that I thought sounded relevant, at first glance...
          I Tried to hook the menu WndProc as you said but for some reson the WndProc i planted never gets called(The Context Menu is displayed Normally as if no alternative wndproc was set)

          This is the code I wrote:

          Code:
             Const GWL_WNDPROC As Int32 = (-4)
             Protected Overrides Function CreateMenuHandle() As System.IntPtr
                  Dim tmp As IntPtr = MyBase.CreateMenuHandle()
                  SetWndProc(tmp)
                  Return tmp
              End Function
              Protected Sub SetWndProc(ByVal hwnd As IntPtr)
                  m_ProcOld = SetWindowLong(hwnd, GWL_WNDPROC, Marshal.GetFunctionPointerForDelegate(New WindowProcCallback(AddressOf WNDProc)))
                  m_Hwnd = hwnd
              End Sub
              Protected Function WNDProc(ByVal hWnd As IntPtr, ByVal iMsg As UInt32, ByVal wParam As UInt32, ByVal lParam As UInt32) As Int32
                  Const WM_DRAWITEM As Int32 = &H2B
                  Const WM_DESTROY As Int32 = &H2
                  MsgBox("WndProc Called")
                  If (iMsg = WM_DRAWITEM) Then Return 0 
                  If (iMsg = WM_DESTROY) Then
                      SetWindowLong(m_Hwnd, GWL_WNDPROC, m_ProcOld)
                  End If
                  Return CallWindowProc(m_ProcOld, hWnd, iMsg, wParam, lParam)
              End Function

          Comment

          • daniel aristidou
            Contributor
            • Aug 2007
            • 494

            #6
            i used to have an application that alowed you to edit your contextmenus... ......i wish i could remember the name....
            ill get back to you here if i find it or remember it.

            Comment

            Working...