C# - Transparency issues

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mcco
    New Member
    • Jul 2008
    • 12

    C# - Transparency issues

    I made a transparent titlebar for my program on photoshop, and saved it as png. Here is a screenshot of the bar(its on black background so you can see it):
    http://img258.imagesha ck.us/img258/8058/trnsptbardi1.pn g

    Now, in VS(2008) I Set the form background to lime, and the transparency key to lime too. I add the titlebar I designed in as a custom control(it's background color is the bar), and it doesn't work.. I mean - I expected to see through the bar the actual screen, but i just see the Lime color under it.. it looks like this:
    http://img177.imagesha ck.us/img177/450/theprogramql8.j pg

    I tried to search for tutorials but i didnt find anything that could help me.
    Please help me figure out the problem or point me to a tutorial.

    Thanks in advance,
    mcComBat.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    I think you need to set like "OwnerDraw" property and possibly draw your png to the graphics object itself?

    Comment

    • mcco
      New Member
      • Jul 2008
      • 12

      #3
      Originally posted by Plater
      I think you need to set like "OwnerDraw" property and possibly draw your png to the graphics object itself?
      hmm, maybe I just didn't get you, but it isnt working..
      What I tried to do is drawing it on the form.. its still green..

      I did it like this:
      Code:
              
      private void mainForm_Paint(object sender, PaintEventArgs e)         
      {
                   Point p = new Point(0, 0);
                   e.Graphics.DrawImage(NewsPro.Properties.Resources.TransparentTitle, p);
      }

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Hmm, well once you create the image object inside your code, pick a pixel location that should contain that lime color and get the RGB value from it (GetPixel i thin kwill return the instance of a Color object which will work).
        And then compare it to the lime color you picked as your transparency key and make sure they are identical.
        They probably are, I just wanted to make sure it just wasn't some subtle differences between the two programs

        Comment

        • mcco
          New Member
          • Jul 2008
          • 12

          #5
          Originally posted by Plater
          Hmm, well once you create the image object inside your code, pick a pixel location that should contain that lime color and get the RGB value from it (GetPixel i thin kwill return the instance of a Color object which will work).
          And then compare it to the lime color you picked as your transparency key and make sure they are identical.
          They probably are, I just wanted to make sure it just wasn't some subtle differences between the two programs
          Yeah, they are identical, and, I didn't get it, what to programs?
          I still cant figure out how to do this..
          I posted a question on MSDN but nobody answered yet..

          Comment

          Working...