Recent

Author Topic: need Owner-Draw with TPopupmenu and can´t get set it  (Read 3953 times)

Leberecht

  • Newbie
  • Posts: 5
need Owner-Draw with TPopupmenu and can´t get set it
« on: January 28, 2012, 01:10:14 pm »
hello,

i´m searching for a long time for this but nobody can help me, but maybe here...

first: i´m developing a win32 app only, so i can use native win32 api calls.
i have a toolbar with a toolbutton, which is a dropdown-style one. the toolbutton is connected to a tpopupmenue.
my problem: the toolbutton and the tpopupmenue must be drawn with custom fonts and background-colors, because my app uses many look&feels and all other components can handle this. i have a image attached, that shows this "situation".
in my code, i tried to set the first menueitem of my tpopupmenue("pmenOptionen") as a Owner-Draw-one but it won´t work.

uses JwaWinUser;

var
    rMII:MENUITEMINFO;
begin
    rMII.cbSize:=sizeof(MENUITEMINFO);
    rMII.fMask:=MIIM_FTYPE;
    rMII.fType:=MFT_OWNERDRAW;
    if SetMenuItemInfo(pmenOptionen.Handle, 0, True, rMII)=False then showmessage('False');

this is my code. the "SetMenuItemInfo" works with no error, but if i open the popupmenue, the system-drawing routines are still in use(because he draws the first menueitem instead of not).
the second thing is, i dont know how to define the custom drawing-routines he shall use and how to draw the menueitems with custom font and backgroundcolor.
has somebody of you ever done this and can show me how to do this in detail?

thanks  a lot

« Last Edit: February 01, 2012, 02:27:11 pm by Leberecht »

lainz

  • Guest
Re: need Owner-Draw with Toolbutton and can´t get set it
« Reply #1 on: January 28, 2012, 11:34:29 pm »
you can attach a sample project? it's very difficult to see the problem.

Leberecht

  • Newbie
  • Posts: 5
Re: need Owner-Draw with Toolbutton and can´t get set it
« Reply #2 on: January 29, 2012, 11:28:26 am »
yes, i have created a sample project. the font and backgound color of the form are custom, but the menueitems of the dropdown-button are not.

 

TinyPortal © 2005-2018