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. Is there a bug with PNG files in Resources in Net 3

Is there a bug with PNG files in Resources in Net 3

Scheduled Pinned Locked Moved C#
help
10 Posts 4 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.
  • N Offline
    N Offline
    Nigel Mackay
    wrote on last edited by
    #1

    If I use an ImageList as my source for a PictureBox I can use JPG and PNG files. If I load the images into Resources, I can still use the JPG files, but the PNG images are not visible. Unfortunately, I need PNG format for the transparency.

    H B 2 Replies Last reply
    0
    • N Nigel Mackay

      If I use an ImageList as my source for a PictureBox I can use JPG and PNG files. If I load the images into Resources, I can still use the JPG files, but the PNG images are not visible. Unfortunately, I need PNG format for the transparency.

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

      I regularly use PNG files as resources, with no problems whatever. Admittedly I rarely use PictureBox, as I find it an unsatisfactory control on many fronts. However, on those occasions that I have used it I have had no problems so long as the image type is one supported by the .Net Framework.

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

      N 1 Reply Last reply
      0
      • H Henry Minute

        I regularly use PNG files as resources, with no problems whatever. Admittedly I rarely use PictureBox, as I find it an unsatisfactory control on many fronts. However, on those occasions that I have used it I have had no problems so long as the image type is one supported by the .Net Framework.

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

        N Offline
        N Offline
        Nigel Mackay
        wrote on last edited by
        #3

        Thanks. Experimenting converting the same image to JPG (so I lose my transparency) I can see my problem. From an ImageList it was made to fit the PictureBox size. From Resources it is not, and what was visible on screen was a tiny, transparent!!, corner of the image. I will have to experiment with formatting the image to be the correct size.

        H 1 Reply Last reply
        0
        • N Nigel Mackay

          Thanks. Experimenting converting the same image to JPG (so I lose my transparency) I can see my problem. From an ImageList it was made to fit the PictureBox size. From Resources it is not, and what was visible on screen was a tiny, transparent!!, corner of the image. I will have to experiment with formatting the image to be the correct size.

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

          The PictureBox has a SizeMode property. Set it to StretchImage to ensure that the image fills the PictureBox. Have a play with the other settings, to get familiar with how it works.

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

          L 1 Reply Last reply
          0
          • H Henry Minute

            The PictureBox has a SizeMode property. Set it to StretchImage to ensure that the image fills the PictureBox. Have a play with the other settings, to get familiar with how it works.

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

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Or throw it out of the window, and paint stuff yourself, then you know all the time what is going on. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


            H 1 Reply Last reply
            0
            • L Luc Pattyn

              Or throw it out of the window, and paint stuff yourself, then you know all the time what is going on. :)

              Luc Pattyn [Forum Guidelines] [My Articles]


              The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


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

              Absotively!! That's what I do. I really cannot remember the last time I used a PictureBox. But then I can't remember the last time I watered the plants or mowed the cat eithter. :)

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

              L 1 Reply Last reply
              0
              • H Henry Minute

                Absotively!! That's what I do. I really cannot remember the last time I used a PictureBox. But then I can't remember the last time I watered the plants or mowed the cat eithter. :)

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

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #7

                Henry Minute wrote:

                I can't remember the last time I watered the plants or mowed the cat eithter.

                Don't worry, once mowed properly a cat doesn't need seconds. :)

                Luc Pattyn [Forum Guidelines] [My Articles]


                The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


                B 1 Reply Last reply
                0
                • L Luc Pattyn

                  Henry Minute wrote:

                  I can't remember the last time I watered the plants or mowed the cat eithter.

                  Don't worry, once mowed properly a cat doesn't need seconds. :)

                  Luc Pattyn [Forum Guidelines] [My Articles]


                  The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


                  B Offline
                  B Offline
                  Baeltazor
                  wrote on last edited by
                  #8

                  :laugh:

                  1 Reply Last reply
                  0
                  • N Nigel Mackay

                    If I use an ImageList as my source for a PictureBox I can use JPG and PNG files. If I load the images into Resources, I can still use the JPG files, but the PNG images are not visible. Unfortunately, I need PNG format for the transparency.

                    B Offline
                    B Offline
                    Baeltazor
                    wrote on last edited by
                    #9

                    Yeah I'm not too sure about that one. I always use PNG as I have found that it has the highest quality and smallest file size. But I have noticed a few problems when using PNG's with the PictureBox, I'm not sure what causes these problems, but all I know is that when I select "Auto-size" I don't have any problems with the PictureBox.

                    N 1 Reply Last reply
                    0
                    • B Baeltazor

                      Yeah I'm not too sure about that one. I always use PNG as I have found that it has the highest quality and smallest file size. But I have noticed a few problems when using PNG's with the PictureBox, I'm not sure what causes these problems, but all I know is that when I select "Auto-size" I don't have any problems with the PictureBox.

                      N Offline
                      N Offline
                      Nigel Mackay
                      wrote on last edited by
                      #10

                      It turns out the problem was with SizeMode. Using an ImageList seems to automatically use Zoom. Taking the image from Resources doesn't, and all I could see was the top left (transparent) corner of my image!!

                      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