Important alert: (current site time 7/16/2013 6:01:22 AM EDT)
 

winzip icon

Flat menu

Email
Submitted on: 12/7/2001 3:47:43 AM
By: Mark van Renswoude  
Level: Intermediate
User Rating: By 11 Users
Compatibility: Delphi 5, Delphi 4
Views: 17453
author picture
 
     An example of ownerdrawing a menu. But, in contrast to most samples, this one also paints the border of the menu... Next on my list is painting bitmaps on the menu for full customization, but this is a little more complicated if the borders are more than 3 pixels wide... Hope this helps :) (btw, had people test it on Windows XP, worked fine too)

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 3 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
12/7/2001 11:24:01 PMkirse

Sweeet! Only one thing... can you make the menu flat before the mouse hovers over it? 5 globes for you.
(If this comment was disrespectful, please report it.)

 
12/10/2001 4:06:50 AMMark van Renswoude

I noticed that too, but the strange thing is, it only happens on some systems. Works fine on mine, but another computer, running Windows 2000 too, displays the 3D border...

Working on a solution though, even if I have to fake the whole menu :)
(If this comment was disrespectful, please report it.)

 
12/12/2001 9:54:46 AMMark van Renswoude

Found the answer, I disabled menu transitions, but if you have the menu either scroll or fade in, the border looks 3D at first.

Still working on a solution :)
(If this comment was disrespectful, please report it.)

 
12/12/2001 10:15:38 AMMark van Renswoude

Got a solution, set MenuAnimation to maNone :)

This will disable both scrolling, and even fading in Win2K...
(If this comment was disrespectful, please report it.)

 
12/21/2001 5:42:57 PMkirse

Ok thanks. I am running Win2k, so that's why I was seeing the "problem". Glad you could fix it!
(If this comment was disrespectful, please report it.)

 
1/17/2002 12:24:04 AMKush Desai

Simple and excellent! This is the reason i chose Delphi in the first place. So easy to extend and customise.

(If this comment was disrespectful, please report it.)

 
3/30/2002 11:54:41 AMChen Friedman

five globes, although you can put some images in this menu 2.
(If this comment was disrespectful, please report it.)

 
11/30/2002 8:17:34 PMVlad Vissoultchev

"Found the answer, I disabled menu
transitions" - the funniest comment ever :-)) what you need to do is to implement WM_PRINT (and/or WM_PRINTCLIENT) message handler. This is used by the OS to "animate" the window content -- this includes fading, roll-up (like in menus and like combos). The idea is that the OS creates a memory dc, selects a bitmap and sends WM_PRINT with wParam being the dc handle to the control/menu for it to render its view. Then the OS grabs the bitmap and does whatever it likes with it.

check out my Office menus at http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=40518&lngWId=1
HTH,
</wqw>

(If this comment was disrespectful, please report it.)

 
3/5/2003 10:55:21 PM

I have 3d borders on win98 when the popup first appears, that's with MenuAnimation set to maNone, it works fine on win2000 and winxp but I guess it would be great if it works on 98,
by the way great work
Kind Regards
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.