Transparency, ASP.NET, and GDI+

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nathan Sokalski

    #16
    Re: Transparency, ASP.NET, and GDI+

    I have tried searching (I've spent almost 2 months trying to find an
    answer), but none of the stuff I found seemed to help.
    --
    Nathan Sokalski
    njsokalski@hotm ail.com
    有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


    "Lloyd Dupont" <ld@NewsAccount .galador.net> wrote in message
    news:%23v1Z$y7n FHA.3380@TK2MSF TNGP12.phx.gbl. ..[color=blue]
    > GWBYF (aka Google Would Be Your Friend != RTFM)
    > http://www.bobpowell.net/giftransparency.htm
    >
    > --
    > If you're in a war, instead of throwing a hand grenade at the enemy, throw
    > one of those small pumpkins. Maybe it'll make everyone think how stupid
    > war is, and while they are thinking, you can throw a real grenade at them.
    > Jack Handey.
    > "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
    > news:%23SuMEt6n FHA.3544@TK2MSF TNGP15.phx.gbl. ..[color=green]
    >>I tried putting a color inside the MakeTransparent method, but it not only
    >>did not make it transparent, but prevented all of the other stuff from
    >>being drawn as well. Here is my code (note that the Clear method has the
    >>same color as the MakeTransparent method):
    >>
    >> Dim transbitmap As New Bitmap(400, 400)
    >> Dim transgraphics As Graphics = Graphics.FromIm age(transbitmap )
    >> Dim transpen As New Pen(Color.FromA rgb(255, 0, 255, 0), 20)
    >> Dim transbrush As New SolidBrush(Colo r.FromArgb(255, 255, 0, 0))
    >>
    >> transgraphics.C lear(Color.From Argb(0, 255, 255, 255))
    >> transbitmap.Mak eTransparent(Co lor.FromArgb(0, 255, 255, 255))
    >> transgraphics.F illRectangle(tr ansbrush, 100, 100, 200, 200)
    >> transgraphics.D rawRectangle(tr anspen, 50, 50, 150, 150)
    >> transbitmap.Sav e(Server.MapPat h("GDItest.gif" ), Imaging.ImageFo rmat.Gif)
    >>
    >> Is there something wrong with the way I am using the MakeTransparent
    >> method? What do I need to do to make areas of my image transparent?
    >> Thanks.
    >> --
    >> Nathan Sokalski
    >> njsokalski@hotm ail.com
    >> http://www.nathansokalski.com/
    >>
    >> "Lloyd Dupont" <ld@NewsAccount .galador.net> wrote in message
    >> news:OxeBOj5nFH A.3408@tk2msftn gp13.phx.gbl...[color=darkred]
    >>> oops.. GIF!
    >>> what about
    >>> Bitmap.MakeTran sparent (Color)
    >>> where Color is your background which might be white per default, I
    >>> believe
    >>>
    >>> --
    >>> If you're in a war, instead of throwing a hand grenade at the enemy,
    >>> throw one of those small pumpkins. Maybe it'll make everyone think how
    >>> stupid war is, and while they are thinking, you can throw a real grenade
    >>> at them.
    >>> Jack Handey.
    >>> "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> wrote in message
    >>> news:OlQAv83nFH A.3448@TK2MSFTN GP12.phx.gbl...
    >>>> Hi Nathan,
    >>>>
    >>>> Okay, basically you have a palette to work with. The article tells you
    >>>> how to define the colors in the palette. Also note that the palette can
    >>>> certainly have LESS than 256 colors if you don't need them all. So,
    >>>> assuming you're drawing with GDI+, you just clear the bitmap to the
    >>>> transparent color, and draw with the others. All of the pixels that
    >>>> have the transparent color will be transparent. It doesn't matter what
    >>>> the transparent color is; it will be defined as "the transparent color"
    >>>> in the palette.
    >>>>
    >>>> --
    >>>> HTH,
    >>>>
    >>>> Kevin Spencer
    >>>> Microsoft MVP
    >>>> .Net Developer
    >>>> Expect the unaccepted.
    >>>>
    >>>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
    >>>> news:%23daSLW3n FHA.1996@TK2MSF TNGP10.phx.gbl. ..
    >>>>>I looked at the article you mentioned, and it definitely cleared up for
    >>>>>me why I was never getting any transparency, but I am still having
    >>>>>trouble figuring out how to fix the problem. I think what I really need
    >>>>>is just a basic example that just draws a simple shape or two and then
    >>>>>adds a transparent area. (Preferably in VB.NET, but I can usually get
    >>>>>enough from C# that it helps enough to solve my problem) Thanks.
    >>>>> --
    >>>>> Nathan Sokalski
    >>>>> njsokalski@hotm ail.com
    >>>>> http://www.nathansokalski.com/
    >>>>>
    >>>>> "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> wrote in message
    >>>>> news:%2335It9yn FHA.3380@TK2MSF TNGP12.phx.gbl. ..
    >>>>>> Hi Nathan,
    >>>>>>
    >>>>>> Sorry, I missed the "gif" reference in your OP.
    >>>>>>
    >>>>>> A GIF image palette can define one color as transparent. I'm not sure
    >>>>>> how you're defining the transparent color in your palette, but the
    >>>>>> following Microsoft KB article explains how to do it. Note that the
    >>>>>> article is not specifically about making a transparent gif, but it
    >>>>>> covers creating a palette with a single transparent color, which is
    >>>>>> encoded as the transparent color for the GIF:
    >>>>>>
    >>>>>> http://support.microsoft.com/default...;EN-US;Q319061
    >>>>>>
    >>>>>> --
    >>>>>> HTH,
    >>>>>>
    >>>>>> Kevin Spencer
    >>>>>> Microsoft MVP
    >>>>>> .Net Developer
    >>>>>> Everybody picks their nose,
    >>>>>> But some people are better at hiding it.
    >>>>>>
    >>>>>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
    >>>>>> news:On0xnMtnFH A.2916@TK2MSFTN GP14.phx.gbl...
    >>>>>>> Like I said in my original message, I am using GIF. The line that I
    >>>>>>> use to save my image is as follows (testbitmap is the name of my
    >>>>>>> System.Drawing. Bitmap object):
    >>>>>>>
    >>>>>>> testbitmap.Save (Server.MapPath ("GDItest.gif") ,
    >>>>>>> Imaging.ImageFo rmat.Gif)
    >>>>>>>
    >>>>>>> --
    >>>>>>> Nathan Sokalski
    >>>>>>> njsokalski@hotm ail.com
    >>>>>>> http://www.nathansokalski.com/
    >>>>>>>
    >>>>>>> "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> wrote in message
    >>>>>>> news:eq$BVdrnFH A.3936@TK2MSFTN GP10.phx.gbl...
    >>>>>>>> The only graphics formats that have transparency in HTML are GIF
    >>>>>>>> and PNG. What format are you using?
    >>>>>>>>
    >>>>>>>> --
    >>>>>>>> HTH,
    >>>>>>>>
    >>>>>>>> Kevin Spencer
    >>>>>>>> Microsoft MVP
    >>>>>>>> .Net Developer
    >>>>>>>> Everybody picks their nose,
    >>>>>>>> But some people are better at hiding it.
    >>>>>>>>
    >>>>>>>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
    >>>>>>>> news:OtgRhOqnFH A.3936@TK2MSFTN GP10.phx.gbl...
    >>>>>>>>>I am trying to create graphics with GDI+ that include transparency.
    >>>>>>>>>Howeve r, the transparency never seems to show up, even though my
    >>>>>>>>>colo rs have an alpha value of 0. How can I generate a graphic that
    >>>>>>>>>is completely transparent in certain areas (so that the web page
    >>>>>>>>>backgr ound shows through)? I save my graphics as gif files. I would
    >>>>>>>>>apprec iate, if possible, a simple example so that I can see the
    >>>>>>>>>code . Thanks.
    >>>>>>>>> --
    >>>>>>>>> Nathan Sokalski
    >>>>>>>>> njsokalski@hotm ail.com
    >>>>>>>>> http://www.nathansokalski.com/
    >>>>>>>>>
    >>>>>>>>
    >>>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>[/color]
    >>
    >>[/color]
    >
    >[/color]


    Comment

    • Lloyd Dupont

      #17
      Re: Transparency, ASP.NET, and GDI+

      allright, allright, but have you checked the link I posted as well?
      (this one: http://www.bobpowell.net/giftransparency.htm)
      should fix it!

      "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message >I have tried
      searching (I've spent almost 2 months trying to find an[color=blue]
      > answer), but none of the stuff I found seemed to help.
      > --
      >
      > "Lloyd Dupont" <ld@NewsAccount .galador.net> wrote in message[color=green]
      >> GWBYF (aka Google Would Be Your Friend != RTFM)
      >> http://www.bobpowell.net/giftransparency.htm[/color][/color]


      Comment

      • Kevin Spencer

        #18
        Re: Transparency, ASP.NET, and GDI+

        Bitmap Transparency is not supported in browsers. Only GIFs and PNGs are
        transparent, and only GIFs are universally transparent in browsers. The
        article I sent you to doesn't use BitMap.MakeTran sparent(). I am not sure
        why you keep bringing this up. It is a simple matter of following
        instructions. The functions you use in your app are not a goal, but should
        only be used if they are a means TO your goal. Let's say you're baking a
        cake. Why on earth would you need or want to use a meat grinder in the
        process? A meat grinder is for grinding meat, not for baking a cake.

        --
        HTH,

        Kevin Spencer
        Microsoft MVP
        ..Net Developer
        Expect the unaccepted.

        "Lloyd Dupont" <ld@NewsAccount .galador.net> wrote in message
        news:OxeBOj5nFH A.3408@tk2msftn gp13.phx.gbl...[color=blue]
        > oops.. GIF!
        > what about
        > Bitmap.MakeTran sparent (Color)
        > where Color is your background which might be white per default, I believe
        >
        > --
        > If you're in a war, instead of throwing a hand grenade at the enemy, throw
        > one of those small pumpkins. Maybe it'll make everyone think how stupid
        > war is, and while they are thinking, you can throw a real grenade at them.
        > Jack Handey.
        > "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> wrote in message
        > news:OlQAv83nFH A.3448@TK2MSFTN GP12.phx.gbl...[color=green]
        >> Hi Nathan,
        >>
        >> Okay, basically you have a palette to work with. The article tells you
        >> how to define the colors in the palette. Also note that the palette can
        >> certainly have LESS than 256 colors if you don't need them all. So,
        >> assuming you're drawing with GDI+, you just clear the bitmap to the
        >> transparent color, and draw with the others. All of the pixels that have
        >> the transparent color will be transparent. It doesn't matter what the
        >> transparent color is; it will be defined as "the transparent color" in
        >> the palette.
        >>
        >> --
        >> HTH,
        >>
        >> Kevin Spencer
        >> Microsoft MVP
        >> .Net Developer
        >> Expect the unaccepted.
        >>
        >> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
        >> news:%23daSLW3n FHA.1996@TK2MSF TNGP10.phx.gbl. ..[color=darkred]
        >>>I looked at the article you mentioned, and it definitely cleared up for
        >>>me why I was never getting any transparency, but I am still having
        >>>trouble figuring out how to fix the problem. I think what I really need
        >>>is just a basic example that just draws a simple shape or two and then
        >>>adds a transparent area. (Preferably in VB.NET, but I can usually get
        >>>enough from C# that it helps enough to solve my problem) Thanks.
        >>> --
        >>> Nathan Sokalski
        >>> njsokalski@hotm ail.com
        >>> http://www.nathansokalski.com/
        >>>
        >>> "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> wrote in message
        >>> news:%2335It9yn FHA.3380@TK2MSF TNGP12.phx.gbl. ..
        >>>> Hi Nathan,
        >>>>
        >>>> Sorry, I missed the "gif" reference in your OP.
        >>>>
        >>>> A GIF image palette can define one color as transparent. I'm not sure
        >>>> how you're defining the transparent color in your palette, but the
        >>>> following Microsoft KB article explains how to do it. Note that the
        >>>> article is not specifically about making a transparent gif, but it
        >>>> covers creating a palette with a single transparent color, which is
        >>>> encoded as the transparent color for the GIF:
        >>>>
        >>>> http://support.microsoft.com/default...;EN-US;Q319061
        >>>>
        >>>> --
        >>>> HTH,
        >>>>
        >>>> Kevin Spencer
        >>>> Microsoft MVP
        >>>> .Net Developer
        >>>> Everybody picks their nose,
        >>>> But some people are better at hiding it.
        >>>>
        >>>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
        >>>> news:On0xnMtnFH A.2916@TK2MSFTN GP14.phx.gbl...
        >>>>> Like I said in my original message, I am using GIF. The line that I
        >>>>> use to save my image is as follows (testbitmap is the name of my
        >>>>> System.Drawing. Bitmap object):
        >>>>>
        >>>>> testbitmap.Save (Server.MapPath ("GDItest.gif") ,
        >>>>> Imaging.ImageFo rmat.Gif)
        >>>>>
        >>>>> --
        >>>>> Nathan Sokalski
        >>>>> njsokalski@hotm ail.com
        >>>>> http://www.nathansokalski.com/
        >>>>>
        >>>>> "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> wrote in message
        >>>>> news:eq$BVdrnFH A.3936@TK2MSFTN GP10.phx.gbl...
        >>>>>> The only graphics formats that have transparency in HTML are GIF and
        >>>>>> PNG. What format are you using?
        >>>>>>
        >>>>>> --
        >>>>>> HTH,
        >>>>>>
        >>>>>> Kevin Spencer
        >>>>>> Microsoft MVP
        >>>>>> .Net Developer
        >>>>>> Everybody picks their nose,
        >>>>>> But some people are better at hiding it.
        >>>>>>
        >>>>>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
        >>>>>> news:OtgRhOqnFH A.3936@TK2MSFTN GP10.phx.gbl...
        >>>>>>>I am trying to create graphics with GDI+ that include transparency.
        >>>>>>>Howeve r, the transparency never seems to show up, even though my
        >>>>>>>colors have an alpha value of 0. How can I generate a graphic that is
        >>>>>>>complete ly transparent in certain areas (so that the web page
        >>>>>>>backgrou nd shows through)? I save my graphics as gif files. I would
        >>>>>>>apprecia te, if possible, a simple example so that I can see the code.
        >>>>>>>Thanks .
        >>>>>>> --
        >>>>>>> Nathan Sokalski
        >>>>>>> njsokalski@hotm ail.com
        >>>>>>> http://www.nathansokalski.com/
        >>>>>>>
        >>>>>>
        >>>>>>
        >>>>>
        >>>>>
        >>>>
        >>>>
        >>>
        >>>[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • Kevin Spencer

          #19
          Re: Transparency, ASP.NET, and GDI+

          Check out the sample code from the article I referred to you:

          protected ColorPalette GetColorPalette ( uint nColors )
          {
          // Assume monochrome image.
          PixelFormat bitscolordepth = PixelFormat.For mat1bppIndexed;
          ColorPalette palette; // The Palette we are stealing
          Bitmap bitmap; // The source of the stolen palette

          // Determine number of colors.
          if (nColors > 2)
          bitscolordepth = PixelFormat.For mat4bppIndexed;
          if (nColors > 16)
          bitscolordepth = PixelFormat.For mat8bppIndexed;

          // Make a new Bitmap object to get its Palette.
          bitmap = new Bitmap( 1, 1, bitscolordepth );

          palette = bitmap.Palette; // Grab the palette

          bitmap.Dispose( ); // cleanup the source Bitmap

          return palette; // Send the palette back
          }

          That doesn't look anything like what you wrote, regardless of the language.
          The palette is retrieved from a Bitmap of a specific paletted format. Are
          you having trouble translating from C# to VB? If so, I can do it for you.

          --
          HTH,

          Kevin Spencer
          Microsoft MVP
          ..Net Developer
          Expect the unaccepted.

          "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
          news:eUOFW$5nFH A.3068@TK2MSFTN GP15.phx.gbl...[color=blue]
          >I am having trouble defining the colors in the palette. The first method I
          >tried gave me the error Object reference not set to an instance of an
          >object. (Which didn't surprise me, but it would not let me use the keyword
          >New when declaring the Imaging.ColorPa lette). Here is that code:
          >
          > Dim transbitmap As New Bitmap(400, 400)
          > Dim transgraphics As Graphics = Graphics.FromIm age(transbitmap )
          > Dim transpen As New Pen(Color.FromA rgb(255, 0, 255, 0), 20)
          > Dim transbrush As New SolidBrush(Colo r.FromArgb(255, 255, 0, 0))
          > Dim transpalette As Imaging.ColorPa lette
          > transpalette.En tries(0) = Color.FromArgb( 0, 255, 255, 255)
          > transpalette.En tries(1) = Color.FromArgb( 255, 0, 255, 0)
          > transpalette.En tries(2) = Color.FromArgb( 255, 255, 0, 0)
          >
          > transgraphics.C lear(Color.From Argb(0, 255, 255, 255))
          > transbitmap.Pal ette = transpalette
          > transgraphics.F illRectangle(tr ansbrush, 100, 100, 200, 200)
          > transgraphics.D rawRectangle(tr anspen, 50, 50, 150, 150)
          > transbitmap.Sav e(Server.MapPat h("GDItest.gif" ), Imaging.ImageFo rmat.Gif)
          >
          >
          > The second method I tried gave me the error Index was outside the bounds
          > of the array. Here is that code:
          >
          > Dim transbitmap As New Bitmap(400, 400)
          > Dim transgraphics As Graphics = Graphics.FromIm age(transbitmap )
          > Dim transpen As New Pen(Color.FromA rgb(255, 0, 255, 0), 20)
          > Dim transbrush As New SolidBrush(Colo r.FromArgb(255, 255, 0, 0))
          > transbitmap.Pal ette.Entries(0) = Color.FromArgb( 0, 255, 255, 255)
          > transbitmap.Pal ette.Entries(1) = Color.FromArgb( 255, 0, 255, 0)
          > transbitmap.Pal ette.Entries(2) = Color.FromArgb( 255, 255, 0, 0)
          >
          > transgraphics.C lear(Color.From Argb(0, 255, 255, 255))
          > transgraphics.F illRectangle(tr ansbrush, 100, 100, 200, 200)
          > transgraphics.D rawRectangle(tr anspen, 50, 50, 150, 150)
          > transbitmap.Sav e(Server.MapPat h("GDItest.gif" ), Imaging.ImageFo rmat.Gif)
          >
          >
          > What I expected from the code above was to create a GIF file with a red
          > filled rectangle, a green unfilled rectangle, and a transparent
          > background. If I remove the lines where I attempt to define the palette,
          > this is what I got except instead of a transparent background I ended up
          > with a black background. What am I supposed to do to create/edit the
          > palette? The article you mentioned took the palette from another Bitmap,
          > which is not something I am planning to do. Thanks.
          > --
          > Nathan Sokalski
          > njsokalski@hotm ail.com
          > http://www.nathansokalski.com/
          >
          > "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> wrote in message
          > news:OlQAv83nFH A.3448@TK2MSFTN GP12.phx.gbl...[color=green]
          >> Hi Nathan,
          >>
          >> Okay, basically you have a palette to work with. The article tells you
          >> how to define the colors in the palette. Also note that the palette can
          >> certainly have LESS than 256 colors if you don't need them all. So,
          >> assuming you're drawing with GDI+, you just clear the bitmap to the
          >> transparent color, and draw with the others. All of the pixels that have
          >> the transparent color will be transparent. It doesn't matter what the
          >> transparent color is; it will be defined as "the transparent color" in
          >> the palette.
          >>
          >> --
          >> HTH,
          >>
          >> Kevin Spencer
          >> Microsoft MVP
          >> .Net Developer
          >> Expect the unaccepted.
          >>
          >> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
          >> news:%23daSLW3n FHA.1996@TK2MSF TNGP10.phx.gbl. ..[color=darkred]
          >>>I looked at the article you mentioned, and it definitely cleared up for
          >>>me why I was never getting any transparency, but I am still having
          >>>trouble figuring out how to fix the problem. I think what I really need
          >>>is just a basic example that just draws a simple shape or two and then
          >>>adds a transparent area. (Preferably in VB.NET, but I can usually get
          >>>enough from C# that it helps enough to solve my problem) Thanks.
          >>> --
          >>> Nathan Sokalski
          >>> njsokalski@hotm ail.com
          >>> http://www.nathansokalski.com/
          >>>
          >>> "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> wrote in message
          >>> news:%2335It9yn FHA.3380@TK2MSF TNGP12.phx.gbl. ..
          >>>> Hi Nathan,
          >>>>
          >>>> Sorry, I missed the "gif" reference in your OP.
          >>>>
          >>>> A GIF image palette can define one color as transparent. I'm not sure
          >>>> how you're defining the transparent color in your palette, but the
          >>>> following Microsoft KB article explains how to do it. Note that the
          >>>> article is not specifically about making a transparent gif, but it
          >>>> covers creating a palette with a single transparent color, which is
          >>>> encoded as the transparent color for the GIF:
          >>>>
          >>>> http://support.microsoft.com/default...;EN-US;Q319061
          >>>>
          >>>> --
          >>>> HTH,
          >>>>
          >>>> Kevin Spencer
          >>>> Microsoft MVP
          >>>> .Net Developer
          >>>> Everybody picks their nose,
          >>>> But some people are better at hiding it.
          >>>>
          >>>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
          >>>> news:On0xnMtnFH A.2916@TK2MSFTN GP14.phx.gbl...
          >>>>> Like I said in my original message, I am using GIF. The line that I
          >>>>> use to save my image is as follows (testbitmap is the name of my
          >>>>> System.Drawing. Bitmap object):
          >>>>>
          >>>>> testbitmap.Save (Server.MapPath ("GDItest.gif") ,
          >>>>> Imaging.ImageFo rmat.Gif)
          >>>>>
          >>>>> --
          >>>>> Nathan Sokalski
          >>>>> njsokalski@hotm ail.com
          >>>>> http://www.nathansokalski.com/
          >>>>>
          >>>>> "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> wrote in message
          >>>>> news:eq$BVdrnFH A.3936@TK2MSFTN GP10.phx.gbl...
          >>>>>> The only graphics formats that have transparency in HTML are GIF and
          >>>>>> PNG. What format are you using?
          >>>>>>
          >>>>>> --
          >>>>>> HTH,
          >>>>>>
          >>>>>> Kevin Spencer
          >>>>>> Microsoft MVP
          >>>>>> .Net Developer
          >>>>>> Everybody picks their nose,
          >>>>>> But some people are better at hiding it.
          >>>>>>
          >>>>>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
          >>>>>> news:OtgRhOqnFH A.3936@TK2MSFTN GP10.phx.gbl...
          >>>>>>>I am trying to create graphics with GDI+ that include transparency.
          >>>>>>>Howeve r, the transparency never seems to show up, even though my
          >>>>>>>colors have an alpha value of 0. How can I generate a graphic that is
          >>>>>>>complete ly transparent in certain areas (so that the web page
          >>>>>>>backgrou nd shows through)? I save my graphics as gif files. I would
          >>>>>>>apprecia te, if possible, a simple example so that I can see the code.
          >>>>>>>Thanks .
          >>>>>>> --
          >>>>>>> Nathan Sokalski
          >>>>>>> njsokalski@hotm ail.com
          >>>>>>> http://www.nathansokalski.com/
          >>>>>>>
          >>>>>>
          >>>>>>
          >>>>>
          >>>>>
          >>>>
          >>>>
          >>>
          >>>[/color]
          >>
          >>[/color]
          >
          >[/color]


          Comment

          • Martin Bourbonnais
            New Member
            • Aug 2005
            • 1

            #20
            Transparent Background

            Dim myBitmap As New Bitmap("Grapes. gif")
            ' Get the color of a background pixel.
            Dim backColor As Color = myBitmap.GetPix el(1, 1)
            ' Make backColor transparent for myBitmap.
            myBitmap.MakeTr ansparent(backC olor)

            Comment

            • Martyn

              #21
              RE: Transparency, ASP.NET, and GDI+


              You should ckeck out this article. It helped me a lot in over coming
              problems with keeping transparency in GIF's.



              Martyn


              "Nathan Sokalski" wrote:
              [color=blue]
              > I am trying to create graphics with GDI+ that include transparency. However,
              > the transparency never seems to show up, even though my colors have an alpha
              > value of 0. How can I generate a graphic that is completely transparent in
              > certain areas (so that the web page background shows through)? I save my
              > graphics as gif files. I would appreciate, if possible, a simple example so
              > that I can see the code. Thanks.
              > --
              > Nathan Sokalski
              > njsokalski@hotm ail.com
              > http://www.nathansokalski.com/
              >
              >
              >[/color]

              Comment

              Working...