473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.
Jan 22 '08 #1
5 1396
debasisdas
8,127 Expert 4TB
you might need to use some third party control for the purpose.
Jan 22 '08 #2
Killer42
8,435 Expert 8TB
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 "subclassing" 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.
Jan 23 '08 #3
Killer42
8,435 Expert 8TB
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...
Jan 23 '08 #4
first thing , thanks everybody for answering.

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:

Expand|Select|Wrap|Line Numbers
  1.    Const GWL_WNDPROC As Int32 = (-4)
  2.    Protected Overrides Function CreateMenuHandle() As System.IntPtr
  3.         Dim tmp As IntPtr = MyBase.CreateMenuHandle()
  4.         SetWndProc(tmp)
  5.         Return tmp
  6.     End Function
  7.     Protected Sub SetWndProc(ByVal hwnd As IntPtr)
  8.         m_ProcOld = SetWindowLong(hwnd, GWL_WNDPROC, Marshal.GetFunctionPointerForDelegate(New WindowProcCallback(AddressOf WNDProc)))
  9.         m_Hwnd = hwnd
  10.     End Sub
  11.     Protected Function WNDProc(ByVal hWnd As IntPtr, ByVal iMsg As UInt32, ByVal wParam As UInt32, ByVal lParam As UInt32) As Int32
  12.         Const WM_DRAWITEM As Int32 = &H2B
  13.         Const WM_DESTROY As Int32 = &H2
  14.         MsgBox("WndProc Called")
  15.         If (iMsg = WM_DRAWITEM) Then Return 0 
  16.         If (iMsg = WM_DESTROY) Then
  17.             SetWindowLong(m_Hwnd, GWL_WNDPROC, m_ProcOld)
  18.         End If
  19.         Return CallWindowProc(m_ProcOld, hWnd, iMsg, wParam, lParam)
  20.     End Function
Jan 23 '08 #5
daniel aristidou
491 256MB
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.
Jan 23 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: James | last post by:
Is there a way to Owner drawn tray context menu ? - I know that there is a bug with the custom drawing of a context menu assigned to a tray icon - but I was hoping someone could advise me as to how...
1
by: boxim | last post by:
hi all, i need to develop a control to show contact details for companies, in a similar fashion to the way outlook shows contacts. at the moment, i'm cheating using HTML fed from a web server,...
2
by: Eric | last post by:
I implemented owner drawing on the main and context menus of my main form. It works fine. There is also a notify icon control that has a context menu. When the icon is in the status bar, it...
1
by: Patty O'Dors | last post by:
Hi I have some code to create an ownerdrawn listbox (derived), and when I add an item to it, the bold text of the first item (the title, 'Collections and Maturities') mysteriously seems to get...
2
by: dan heskett | last post by:
I am owner-drawing a listbox, in an attempt to create a nice list with some custom "fields" and text layout. Essentially it works, but I must be missing something big, conceptually, because I...
0
by: Brian Henry | last post by:
Ok whats going on here... got a couple problems... this is relevant now to this group since .NET 2.0 is finally RTM 1) draws really slow when making it a large form (resizing speed is jerky) to...
0
by: Brian Henry | last post by:
I cant seem to remember this one... I have a list view, and im owner drawing the items, i dont want the selection to hide when it loses focus so i have hideselection = false, but when i owner draw...
0
by: Steve Marshall | last post by:
Hi All, I'm working on an owner-drawn combo box which will display multiple columns in the list, either from a table in an associated DataSourse or from delimited strings in the Items...
0
by: LostInMd | last post by:
Hi All, I've got an owner drawn listBox where I draw and measure the items that I add to the listBox. For example, I have a listBox that can only display 10 characters on each horizontal line. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.