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. ComboBox DropDown

ComboBox DropDown

Scheduled Pinned Locked Moved C#
helpquestion
4 Posts 3 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.
  • S Offline
    S Offline
    Shaun Becker
    wrote on last edited by
    #1

    I need to create a combo box control with a custom drop down. Now, before I try to create this from scratch, is there a way to disable the drop down? Thanks for your help

    N 1 Reply Last reply
    0
    • S Shaun Becker

      I need to create a combo box control with a custom drop down. Now, before I try to create this from scratch, is there a way to disable the drop down? Thanks for your help

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Disable the dropdown? You mean like a listbox?

      S 1 Reply Last reply
      0
      • N Not Active

        Disable the dropdown? You mean like a listbox?

        S Offline
        S Offline
        Shaun Becker
        wrote on last edited by
        #3

        No, I need to disable the drop down box for the combobox control. I need to do this so that I can have a custom drop down appear.

        H 1 Reply Last reply
        0
        • S Shaun Becker

          No, I need to disable the drop down box for the combobox control. I need to do this so that I can have a custom drop down appear.

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

          You could try extending ComboBox, then override WndProc. For the CBN_DROPDOWN notification message (msg id 7), return instead of calling the base.WndProc:

          protected override void WndProc(ref Message m)
          {
          if (m.Msg == 7) return;
          base.WndProc(ref m);
          }

          That may stop it, but the documentation for that notification message doesn't mention how to stop it. By not passing the notification message to the ComboBox, though, it shouldn't display the popup window that represents the drop-down. It's worth a shot. Also, you should consider making your own from scratch. If the above doesn't work, it's often easier making your own controls that trying to change existing ones. Remember that almost every control in System.Windows.Forms is just a wrapper class for their Windows Common Controls equivalent, so the true behavior of the control itself is defined by native code. If you must make your own, I suggest you download something like .NET Reflector[^] to peer inside how the System.Windows.Forms.ComboBox works for things that aren't apparent in the documentation.

          -----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-----

          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