transparency Q

  • Thread starter Thread starter Martin Williams
  • Start date Start date
M

Martin Williams

I used the example on Bob Powell's site to draw a gradient on the background
of the parent form in my survey app. Now, I would like to have a logo
docked in the corner, but have the background of the logo be the gradient,
not the base color of the window. The logo is a gif set with a transparent
color. Any suggestions?
 
Martin Williams said:
Now, I would like to have a logo
docked in the corner, but have the background of the logo be the gradient,
not the base color of the window. The logo is a gif set with a
transparent
color.

Instead of putting a pixturebox onto the form, use the 'Graphics' object's
'DrawImage' method to draw the image on top of the gradient (similar to
drawing the gradient). You can use 'Image.FromFile' to load an image from
disk, .NET will draw the image transparently automatically.
 
thanks, that did it. But, I have another Q...

On the last form of the survey, there are some textboxes. When the form is
activated, I set the focus to the "Finish" button to avoid seeing the
insertion point in the textbox right away. However, when I tab through the
controls, that first press of the tab button causes a momentary flicker on
the screen, then it goes away. Any idea on what causes that?
 
One more question - is there a way I can get the logo that was drawn with
DrawImage to be in a relative position?
 
Martin Williams said:
One more question - is there a way I can get the logo that was drawn with
DrawImage to be in a relative position?

You will have to listen for the window's 'Resize' or 'SizeChanged' event and
call the form's/control's 'Invalidate' method there in order to repaint the
background.
 
Thanks again!

Herfried K. Wagner said:
You will have to listen for the window's 'Resize' or 'SizeChanged' event and
call the form's/control's 'Invalidate' method there in order to repaint the
background.
 
Back
Top