[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1692
  • Last Modified:

How to redraw menu in a dialog

Hi,
I have a dialog that contains a menu.
In a certain point I am disable all menu items and then, enable the menuitems back.
For some reason, the menu doesn't repaint and if I disable the menuitems, they don't look gray. Only after I will move the cursor on top the menuitems, they will redraw.

the following link was supposed to fix my problem but it doesn't :
http://support.microsoft.com/kb/242577


Attached, is a sample project that contains a menu in dialog with the code suggested by the link above.

 added a timer that change to menu enable status every 1 sec.
What I want is that the disable will look gray without the need to move the cursor on top the menu in order to make it redraw

I added .txt to all files so I can zip it and add it as attachment here.

Thanks,
Udi Raz
MenuInDialog.zip
0
UdiRaz
Asked:
UdiRaz
1 Solution
 
CSecurityCommented:
call UpdateWindow() function. may solve your problem...
0
 
Mark_FreeSoftwareCommented:
you might want to look into the function InvalidateRect,
basically this function tells a window it needs to redraw
http://msdn.microsoft.com/en-us/library/ms534893(VS.85).aspx
0
 
UdiRazAuthor Commented:
C Security : UpdateWindow() didn't help
Mark :
      CRect rect;
      GetWindowRect( rect );
      InvalidateRect( rect );

Didn't work either.

please check the sample project I attached
0
 
alb66Commented:
Try to call DrawMenuBar().
I cannot try your code since I have an older version of visual studio...
0
 
UdiRazAuthor Commented:
Simple and beautiful. Thanks
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now