all groups > dotnet windows forms > february 2004 >
You're in the

dotnet windows forms

group:

transparent controls


Re: transparent controls David Clegg
2/29/2004 5:26:16 PM
dotnet windows forms:
[quoted text, click to view]

Could you post your form_paint code? I had a similar problem due to a
silly oversight on my part. Instead of using the Graphics object passed
in the PaintEventArgs, I was creating my own. End result; controls
didn't have transparent backgrounds.

--
Cheers,
David Clegg
dclegg_at_ebetonline_dot_com

"Vampires are make believe, just like elves and gremlins and
transparent controls Derrick
2/29/2004 7:45:12 PM
Is it possible to make the background color of controls (such as group
boxes, lables, text boxes and check boxes, tabpage ) to transparent?

In case you need more information, I have added some code to the form_paint
method to paint the background with a gradiant. I need to get the controls
on the form to match the same look. The only alternative I could come up
with was to create an image with the color gradiant, and setting that to the
background of the form and controls - which really seems to be a silly
approach.

Thanks for any help.

Derrick

Re: transparent controls Derrick
3/1/2004 12:35:28 AM
Yep - the transparent Back color doesn't work with any controls that I have
seen. Using that setting makes all controls have the 'control' color
background in run time.

Derrick

[quoted text, click to view]

Re: transparent controls Derrick
3/1/2004 2:37:36 AM
Here it is...

Private Sub frmMain_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim objBrush As New
Drawing2D.LinearGradientBrush(Me.DisplayRectangle, Color.White,
Color.CornflowerBlue, Drawing2D.LinearGradientMode.Vertical)
Dim objGraphics As Graphics = Me.CreateGraphics()
objGraphics.FillRectangle(objBrush, Me.DisplayRectangle)
objBrush.Dispose()
objGraphics.Dispose()
End Sub

Thanks

Derrick

[quoted text, click to view]

Re: transparent controls Derrick
3/1/2004 2:47:44 AM
And, thanks to David's great insight, I did find the problem... I modified
the paint method to:

Private Sub Form_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

Dim objBrush As New Drawing2D.LinearGradientBrush(Me.DisplayRectangle,
Color.White, Color.CornflowerBlue, Drawing2D.LinearGradientMode.Vertical)
e.Graphics.FillRectangle(objBrush, Me.DisplayRectangle)
objBrush.Dispose()

End Sub
Thanks for the help

Derrick

[quoted text, click to view]

Re: transparent controls Eric Eggermann
3/1/2004 8:58:18 AM

[quoted text, click to view]

Did you try setting the backcolor to transparent on the controls? That
should do what you want. Click the controls backcolor in the property
window. It's towards the top of the Web tab in the color editor that pops
up.

HTH
Eric

Re: OT: Re: transparent controls David Clegg
3/1/2004 1:48:29 PM
[quoted text, click to view]

<g>

Didn't help much during the RWC though. Oh well, at least LOTR cleaned
up the Oscars :-)

--
Cheers,
David Clegg
dclegg_at_ebetonline_dot_com

OT: Re: transparent controls hirf-spam-me-here NO[at]SPAM gmx.at
3/1/2004 4:16:36 PM
* "David Clegg" <dclegg@nospam.ebetonline.com> scripsit:
[...]

Nice X-Face.

--
Herfried K. Wagner [MVP]
AddThis Social Bookmark Button