Transparent Image?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Linsolv
    New Member
    • Mar 2009
    • 4

    Transparent Image?

    I have seen many similar questions to mine, and I think I might have found one that was almost the same, but none of the solutions worked that I found.

    I have a C# Windows form application, with an image over an image; If the top image were rectangular, this would work fine. But the problem is, it's not, and the top image is taking up too much space with it's "control" colored background.

    I can make the background of the top image completely transparent using a transparency key, and I can (obviously) make the top image disappear by just turning off visibility. I need to be able to see both, without also dimming my top image. I actually managed to get the image itself transparent, so that the background color of the control shows through (I heard that panels worked better than PictureBox's with transparency, so I've been experimenting with those, too).

    Is this impossible, or am I just not understanding the answers I found, or... ?
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Lots of background... I'm having trouble finding the actual goal and problem.

    You want to see one image that is laid on top of another image, without "dimming" the top image, meaning you want it to be 100% opaque.

    What exactly is the problem you are running into? Could you post a photo showing the bad result and describe what you are trying to avoid?

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      I am confused, what exactly do you want to do here?
      You have a picture of slightly smaller/non-rectanglular size over the top of another picture, and don't want the corners of that control to show up?
      Setting the background of that control to transparent should have been enough?

      Comment

      • Linsolv
        New Member
        • Mar 2009
        • 4

        #4
        I have an image, a large square. Over that, I have a smaller image. The smaller image is non-rectangular. The outside parts of the image shows through to the background color of the top box. Or, I can set the transparency key to the background color, and it shows through to my desktop.

        A screen shot from my program.



        edit: If you look at the example, I want the pink parts to show the card behind it.

        Comment

        • tlhintoq
          Recognized Expert Specialist
          • Mar 2008
          • 3532

          #5
          Or, I can set the transparency key to the background color, and it shows through to my desktop.
          Like all the way down to the WIndows desktop?

          I would have figured if you set the transparacy for just the pointer image, but not for the card image you would have been ok.

          Can you show us the code where you are doing all this?

          Comment

          • Linsolv
            New Member
            • Mar 2009
            • 4

            #6
            Well.. I'm kinda noob-ish; I learn what I need when I need it.

            When it shows through to the desktop, I set the Transparency Key of the form to the background color (MVS calls it "Crimson.") .

            The transparency part is:

            this.Transparen cyKey = System.Drawing. Color.Crimson;

            Comment

            • tlhintoq
              Recognized Expert Specialist
              • Mar 2008
              • 3532

              #7
              Ok... So the two images you have... where exactly do they live?
              Is one a picturebox and one the background image of the form?
              Instead of setting the transparancy of the form, try setting it for just where you are showing your pointer graphic overlay.

              Comment

              • Linsolv
                New Member
                • Mar 2009
                • 4

                #8
                I wasn't sure if it was appropriate to explain the details of implementation, but I'll explain.

                The background is actually one of 9 images, placed in a sort-of grid as pictureboxes. This is so that I can scroll through a much larger map.

                The front picture is also a picturebox, but like I said I've been experimenting with Panels.

                I'm sorry, but I don't know what your advice means.

                Comment

                • tlhintoq
                  Recognized Expert Specialist
                  • Mar 2008
                  • 3532

                  #9
                  TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

                  Comment

                  Working...