Re: GDI and image displays

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Tim Wilson ("Tim)
Date: 11/24/04


Date: Wed, 24 Nov 2004 10:16:35 -0500

So it sounds like you start with a gradient background on your form and then
you want to paint an image on top of that, correct? How are you painting the
gradient effect onto the form?

-- 
Tim Wilson
.Net Compact Framework MVP
"Glyn Meek" <gjmeek@earthlink.net> wrote in message
news:LzUod.2551$NU3.2356@newsread1.news.pas.earthlink.net...
> Tim, I think I have the mechanism down OK, but the problem is that I am
> using transparent images and when I write one on top of the other, the
> underlying original one shows through the 'transparent' parts and I want
the
> original background to show...so, I am assuming the following technique
> (which may be my basic mistake in understanding the way graphics are
> written!)
>
> 1) I have to capture the original background (which is a gradual shading)
> before drawing the first image
> 2) when 'overwriting' with a subsequent image, I have to rewrite the
> original image back and then write the new image over that...correct?
> ...or, does invalidate juts 'get rid of' the original image and leave me
> with the bare form? If it does, then I did NOT realize that the images
were
> effectively laid down in layers!
>
> Glyn
>
> "Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in message
> news:evXK5n$yEHA.1256@TK2MSFTNGP10.phx.gbl...
> > So you're drawing one image and then you want to change and draw another
> > but
> > not have the original displayed anymore? Where are you calling DrawImage
> > from? If you're performing your image drawing in the OnPaint override,
or
> > a
> > Paint event handler, then you just need to cause a refresh using, as one
> > option, the Invalidate method. Then simply draw the new image and do not
> > draw the old one. If you are not drawing your images through the
> > OnPaint/Paint options, is there a specific reason why?
> >
> > -- 
> > Tim Wilson
> > .Net Compact Framework MVP
> >
> > "Glyn Meek" <gjmeek@earthlink.net> wrote in message
> > news:nxomd.27892$KJ6.6979@newsread1.news.pas.earthlink.net...
> >> I have a routine which uses the GDI to display an image using
> > '.DrawImage'.
> >>
> >> Sections of the image have been made transparent using
> >> '.MakeTransparent'.
> >>
> >> Everything works well...
> >>
> >> ...BUT, I later need to replace the original image with a second image,
> > also
> >> with some transparent sections and cannot seem to find a way to do
this.
> > If
> >> I merely use 'DrawImage to write the new image, sections of the old
image
> >> show through where the new image is transparent.
> >>
> >> I have tried putting both images in Rectangles, and manipulating the
> >> rectangles, but this doesn't seem to work either.
> >>
> >> I tried to find a way to capture (and then restore) the original
> > background
> >> on the screen before the first image was drawn, but is BitBlt the only
> >> way
> >> to do this?
> >>
> >> Any GDI experts out there that can give me a hint as to how to get rid
of
> >> the original image altogether? or do I need to dive into the arcane
world
> > of
> >> BitBlt, and if so, anyone got a good reference?
> >>
> >> Regards
> >>
> >> Glyn J Meek
> >>
> >>
> >>
> >
> >
>
>


Relevant Pages

  • Re: Transparent BG for loaded Image
    ... >> have it as BufferedImage. ... >> but with it's background beeing transparent. ... > paint over which). ... > using the Graphics2D object. ...
    (comp.lang.java.programmer)
  • Re: What control is being painted?
    ... Transparent meant they would not paint a background colour, ... > color set in their parents BackColor property. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: What control is being painted?
    ... Transparent meant they would not paint a background colour, ... > color set in their parents BackColor property. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Transparent BG for loaded Image
    ... > have it as BufferedImage. ... Then that part of the image which should be transparent needs to have ... and actually paint the underlying image over the top image. ... > is a blue filled circle with a magenta background. ...
    (comp.lang.java.programmer)
  • Re: GDI and image displays
    ... Tim, I think I have the mechanism down OK, but the problem is that I am ... underlying original one shows through the 'transparent' parts and I want the ... > So you're drawing one image and then you want to change and draw another ... Then simply draw the new image and do not ...
    (microsoft.public.dotnet.framework.compactframework)