Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Owner drawn menus

Owner drawn menus

Scheduled Pinned Locked Moved C#
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    UB
    wrote on last edited by
    #1

    How can I create a borderless menu or a transparent menu when creating a owner drawn menu? I have seen this in the Winamp 3x. UB You may stop this individual, but you can't stop us all... after all, we're all alike. +++Mentor+++

    H 1 Reply Last reply
    0
    • U UB

      How can I create a borderless menu or a transparent menu when creating a owner drawn menu? I have seen this in the Winamp 3x. UB You may stop this individual, but you can't stop us all... after all, we're all alike. +++Mentor+++

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      To make a menu transparent, you can use Menu.Handle to get an HWND for the popup window that represents that menu and use the native function SetLayeredWindowAttributes (you'll have to P/Invoke it). To draw the menu without a border, you'll have to handle the MenuItem.DrawItem event and do all the drawing yourself. You can find several examples here on CodeProject using a search like menu draw[^] or similar. Dr. Gui on MSDN[^] also had a good example some time back at http://msdn.microsoft.com/library/en-us/dnaskdr/html/askgui11062001.asp[^]. The example's in VB.NET but it's mostly method calls (remember, the base class library - or any assembly for that matter - is available to all languages that target the CLR, or ".NET languages", in the same way; though, the syntax for making those calls may be different).

      -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

      U 1 Reply Last reply
      0
      • H Heath Stewart

        To make a menu transparent, you can use Menu.Handle to get an HWND for the popup window that represents that menu and use the native function SetLayeredWindowAttributes (you'll have to P/Invoke it). To draw the menu without a border, you'll have to handle the MenuItem.DrawItem event and do all the drawing yourself. You can find several examples here on CodeProject using a search like menu draw[^] or similar. Dr. Gui on MSDN[^] also had a good example some time back at http://msdn.microsoft.com/library/en-us/dnaskdr/html/askgui11062001.asp[^]. The example's in VB.NET but it's mostly method calls (remember, the base class library - or any assembly for that matter - is available to all languages that target the CLR, or ".NET languages", in the same way; though, the syntax for making those calls may be different).

        -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

        U Offline
        U Offline
        UB
        wrote on last edited by
        #3

        Thanks for the advice. I found several articles on CodeProject. To make it borderless they have used subclassing. It's a war out there. Some of them have used hooks, and some of them are against using hooks :) By the way I went to geekcode.com, and now I know what's that first three letters mean :) Thanks again. UB You may stop this individual, but you can't stop us all... after all, we're all alike. +++Mentor+++

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups