transparency Q

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?
 
H

Herfried K. Wagner [MVP]

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.
 
M

Martin Williams

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?
 
M

Martin Williams

One more question - is there a way I can get the logo that was drawn with
DrawImage to be in a relative position?
 
H

Herfried K. Wagner [MVP]

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.
 
M

Martin Williams

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top