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. Different size icons in treeview

Different size icons in treeview

Scheduled Pinned Locked Moved C#
helpquestion
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.
  • V Offline
    V Offline
    viciouskinid
    wrote on last edited by
    #1

    Hi, I would like to display two different Icons next to my nodes in a treeview only problem is they are different sizes. I could set the Image list to the size of the largest one but i dont want big gaps around the smallest one. Can anyone help me out?

    J 1 Reply Last reply
    0
    • V viciouskinid

      Hi, I would like to display two different Icons next to my nodes in a treeview only problem is they are different sizes. I could set the Image list to the size of the largest one but i dont want big gaps around the smallest one. Can anyone help me out?

      J Offline
      J Offline
      Jimmanuel
      wrote on last edited by
      #2

      you could use an image editor to resize your images . . .

      V 1 Reply Last reply
      0
      • J Jimmanuel

        you could use an image editor to resize your images . . .

        V Offline
        V Offline
        viciouskinid
        wrote on last edited by
        #3

        sorry I must not have explained myself properly. As far as I can tell to use icons in treeview you create an image list. This image list is then used by treeview. My problem is that the image list only outputs images to treeview of one size. I can generate images of any size i like but they are scaled by the imagelist to say 32x32. in this case the image i have of 32x32 will be fine but the image i have of 16x16 will be stretched to 32x32. I dont want to stretch my image to 32x32. I could use an image editor to make it 32x32 and keep the actual image the same size but it leaves big gaps in my treeviw and looks really bad. any ideas?

        J 1 Reply Last reply
        0
        • V viciouskinid

          sorry I must not have explained myself properly. As far as I can tell to use icons in treeview you create an image list. This image list is then used by treeview. My problem is that the image list only outputs images to treeview of one size. I can generate images of any size i like but they are scaled by the imagelist to say 32x32. in this case the image i have of 32x32 will be fine but the image i have of 16x16 will be stretched to 32x32. I dont want to stretch my image to 32x32. I could use an image editor to make it 32x32 and keep the actual image the same size but it leaves big gaps in my treeviw and looks really bad. any ideas?

          J Offline
          J Offline
          Jimmanuel
          wrote on last edited by
          #4

          you can tell the imagelist what size to make your images: ImageList.ImageSize[^]. The docs say the default is 16x16 so if they're being scaled to 32x32 then maybe something is changing the default value and you need to reset it to the size you want.

          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