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. Windows Graphics, or ComboBox Question.

Windows Graphics, or ComboBox Question.

Scheduled Pinned Locked Moved C#
questionhelpgraphics
4 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.
  • D Offline
    D Offline
    DougW48
    wrote on last edited by
    #1

    I have 2 questions, and answering either will easily solve a problem. The first, where might I find the lovely bitmaps and such that Microsoft uses in their operating system so that I can use these same ones in my application? Particularly, the arrow button that you see at the ends of slider bars and combo boxes. ~OR~ If I have a combobox with nothing in its list, and I click the dropdown button, how can I prevent the list from showing one blank line? Either answer will help! Thanks a bunch. - D

    H 1 Reply Last reply
    0
    • D DougW48

      I have 2 questions, and answering either will easily solve a problem. The first, where might I find the lovely bitmaps and such that Microsoft uses in their operating system so that I can use these same ones in my application? Particularly, the arrow button that you see at the ends of slider bars and combo boxes. ~OR~ If I have a combobox with nothing in its list, and I click the dropdown button, how can I prevent the list from showing one blank line? Either answer will help! Thanks a bunch. - D

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

      See the ControlPaint.DrawComboButton method in the .NET Framework SDK for one option. Otherwise, you'll need to include bitmaps yourself, either embedding them into a ResX file (using an ImageList in the designer does this for you, which base64-encodes it) or embed them as manifest resources by adding them to your project and changing the build action to "Embedded Resource". You can access these bitmaps (which I use generically for pixel map images) using Assembly.GetManifestResourceStream or some methods on the Image and Bitmap classes allow you to specify a manifest resource from which an Image or Bitmap (derivative of Image) is created. It's important to understand that most of the Windows Forms controls are not implement in .NET, per se. They encapsulate the Windows Common Controls, so it's the native window classes that are being used and which take care of drawing themselves (for the most part).

      Microsoft MVP, Visual C# My Articles

      D 1 Reply Last reply
      0
      • H Heath Stewart

        See the ControlPaint.DrawComboButton method in the .NET Framework SDK for one option. Otherwise, you'll need to include bitmaps yourself, either embedding them into a ResX file (using an ImageList in the designer does this for you, which base64-encodes it) or embed them as manifest resources by adding them to your project and changing the build action to "Embedded Resource". You can access these bitmaps (which I use generically for pixel map images) using Assembly.GetManifestResourceStream or some methods on the Image and Bitmap classes allow you to specify a manifest resource from which an Image or Bitmap (derivative of Image) is created. It's important to understand that most of the Windows Forms controls are not implement in .NET, per se. They encapsulate the Windows Common Controls, so it's the native window classes that are being used and which take care of drawing themselves (for the most part).

        Microsoft MVP, Visual C# My Articles

        D Offline
        D Offline
        DougW48
        wrote on last edited by
        #3

        I like the ControlPaint.DrawComboButton method, however, why doesn't the OnPaint handler fire in a class inherited from a TextBox? If I change the base class to Label, or another control, the OnPaint handler fires, but not with TextBox...any ideas?

        H 1 Reply Last reply
        0
        • D DougW48

          I like the ControlPaint.DrawComboButton method, however, why doesn't the OnPaint handler fire in a class inherited from a TextBox? If I change the base class to Label, or another control, the OnPaint handler fires, but not with TextBox...any ideas?

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

          It's not supposed to fire. As I've tried to remind those in this forum many times, most of the Windows Forms controls encapsulate the Windows Common Controls. The TextBox encapsulates (wraps) the Edit control, which paints itself and cannot be overridden as many other controls can (like the Static class, which is encapsulated in the Label class). Even the ListView doesn't work the same with the call to OnPaint. In order to custom draw items, you have to handle the right notification messages.

          Microsoft MVP, Visual C# My Articles

          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