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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Shrinking Toolbar images

Shrinking Toolbar images

Scheduled Pinned Locked Moved C#
databasehelpquestion
5 Posts 2 Posters 1 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.
  • L Offline
    L Offline
    LannieK
    wrote on last edited by
    #1

    I am making my first attempt at using the ToolBar. I have defined an ImageList, and put a 16x16 pixel in it, and associated the first button in my ToolBar with index 0. The problem is, the image that is already only 16x16 shows up on the ToolBar button as shrunken to an even smaller size. AutoSize is set to true for the ToolBar, and the ImageList shows the image size as 16x16. Am I missing an important setting? What could be causing the incredible shrinking image? And on a tangent, why doesn't the Transparent property of ImageList work?:confused:

    H 1 Reply Last reply
    0
    • L LannieK

      I am making my first attempt at using the ToolBar. I have defined an ImageList, and put a 16x16 pixel in it, and associated the first button in my ToolBar with index 0. The problem is, the image that is already only 16x16 shows up on the ToolBar button as shrunken to an even smaller size. AutoSize is set to true for the ToolBar, and the ImageList shows the image size as 16x16. Am I missing an important setting? What could be causing the incredible shrinking image? And on a tangent, why doesn't the Transparent property of ImageList work?:confused:

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

      Even though the toolbox button size is automatic, what does it report in the PropertyGrid for the ToolBar.ButtonSize? This should be something larger than 16x16 since a margin is required to draw the buttons both in 3D and flat (for when you hover) mode. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

      L 1 Reply Last reply
      0
      • H Heath Stewart

        Even though the toolbox button size is automatic, what does it report in the PropertyGrid for the ToolBar.ButtonSize? This should be something larger than 16x16 since a margin is required to draw the buttons both in 3D and flat (for when you hover) mode. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

        L Offline
        L Offline
        LannieK
        wrote on last edited by
        #3

        The ButtonSize is shown as 24, 24. That should be plenty for a 16x16 image. The button is displayed with a gap of several pixels between the shading on the edges of the button and the shrunken image.

        H 1 Reply Last reply
        0
        • L LannieK

          The ButtonSize is shown as 24, 24. That should be plenty for a 16x16 image. The button is displayed with a gap of several pixels between the shading on the edges of the button and the shrunken image.

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

          Yeah, that definitely sounds right. Did you set the ImageList.ImageSize property before or after you added the images? It's important to have all properties set before you add images, including the ImageSize and TransparentColor. If you didn't set these first, you'll need to remove your ImageList (i.e., delete it completely) and recreate it with the proper property values, then add your images. If you did perform those operations in that order, than frankly I'm at a loss. You could try to unassign the ImageList from the control, close the designer (perhaps close VS.NET entirely), then re-open the control and reassign the ImageList. Sometimes - but rarely in my experience - the designer state gets a little "off" and needs a kick in the pants. I doubt this is the problem though; it's rare and is often caused by massive number of changes to the designer, especially when working with custom controls. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

          L 1 Reply Last reply
          0
          • H Heath Stewart

            Yeah, that definitely sounds right. Did you set the ImageList.ImageSize property before or after you added the images? It's important to have all properties set before you add images, including the ImageSize and TransparentColor. If you didn't set these first, you'll need to remove your ImageList (i.e., delete it completely) and recreate it with the proper property values, then add your images. If you did perform those operations in that order, than frankly I'm at a loss. You could try to unassign the ImageList from the control, close the designer (perhaps close VS.NET entirely), then re-open the control and reassign the ImageList. Sometimes - but rarely in my experience - the designer state gets a little "off" and needs a kick in the pants. I doubt this is the problem though; it's rare and is often caused by massive number of changes to the designer, especially when working with custom controls. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

            L Offline
            L Offline
            LannieK
            wrote on last edited by
            #5

            That solved the problem! I made a new ImageList, with the right properties set, added the exact same image to it, then associated the image list with the toolbar. Now the image is behaving properly, including the transparency. Thanks!

            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