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. adding PNG icons with tranparency to listview

adding PNG icons with tranparency to listview

Scheduled Pinned Locked Moved C#
graphicshelp
2 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.
  • M Offline
    M Offline
    Muhammad Ahmed 0
    wrote on last edited by
    #1

    Hello every one, I am using the following code to add items to my listview I have PNG icons 16x 16 with transparency , unfortunately the icons as a result of this code look really bad in the listvirew. looks like it is not getting the transparency of the the image, PLease help, thanks in advacne.. Ahmed ImageList imList = new ImageList(); Image img = new System.Drawing.Bitmap(@"D:\Resources\PNG\User.png"); imList.Images.Add(img); listViewUsers.SmallImageList = imList; foreach (MItem mItem in items) { this.listViewUsers.Items.Add("hello world", "hello world", 0); }

    Ahmed

    H 1 Reply Last reply
    0
    • M Muhammad Ahmed 0

      Hello every one, I am using the following code to add items to my listview I have PNG icons 16x 16 with transparency , unfortunately the icons as a result of this code look really bad in the listvirew. looks like it is not getting the transparency of the the image, PLease help, thanks in advacne.. Ahmed ImageList imList = new ImageList(); Image img = new System.Drawing.Bitmap(@"D:\Resources\PNG\User.png"); imList.Images.Add(img); listViewUsers.SmallImageList = imList; foreach (MItem mItem in items) { this.listViewUsers.Items.Add("hello world", "hello world", 0); }

      Ahmed

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      It is not your ListView that is the problem but the ImageList. This is a well known problem and it is disgusting IMNSHO that M$ have not fixed this huge bug by .NET 3.5! :mad: My rant doesn't help you though, so take a look at this CP article Adding and using 32 bit alphablended images and icons to the imagelist control[^] to see if it helps you understand what is happening. If that is no help try Googling on C# imagelist transparency. You will get loads and loads of hits. Good luck! :)

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      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