By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,815 Members | 1,152 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,815 IT Pros & Developers. It's quick & easy.

Need transparent label but with a slight difference

P: n/a
Hi,

I need to do a transparent label but with a difference.

I have drawn on my form a custom background using CreateGraphics as I needed an ellipse looking fill in a rectangle - so the actual background colour of the form is still set to "control" colour.

If I use the background transparent setting instead of seeing my drawn on background and it's gradient i see the forms background colour. If the label was on a solid coloured bit of drawing I would set it to that but since it sits over part of the gradient I need i tto be transparent to show the custom drawing.

Any ideas?

Thanks
Adam

Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Why have you used createGraphics when you already have a Graphics object(e.Graphics) in the Paint method?
If you use that GraphicsObject, the label will appear Transparent.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Adam Maltby" <ad***@frfl.co.uk> wrote in message news:u9**************@TK2MSFTNGP11.phx.gbl...
Hi,

I need to do a transparent label but with a difference.

I have drawn on my form a custom background using CreateGraphics as I needed an ellipse looking fill in a rectangle - so the actual background colour of the form is still set to "control" colour.

If I use the background transparent setting instead of seeing my drawn on background and it's gradient i see the forms background colour. If the label was on a solid coloured bit of drawing I would set it to that but since it sits over part of the gradient I need i tto be transparent to show the custom drawing.

Any ideas?

Thanks
Adam
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.737 / Virus Database: 491 - Release Date: 11/08/2004
Nov 21 '05 #2

P: n/a
Hi,

But it going transparent all the way to the form background - i need it to transparent to the gradient I drew on the form.

Cheers
Adam

Nov 21 '05 #3

P: n/a
If you draw the form background in the forms Paint method using the Graphics object e.Graphics, then the transparent label will paint itself with the Gradient that you drew on the form.
If you Draw the forms background outside of the paint method using CreateGraphics, then the transparent label will paint itself with the forms backcolor.

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

Dim FillBrush As New Drawing2D.LinearGradientBrush(ClientRectangle, _
Color.Blue, Color.Red, _
Drawing2D.LinearGradientMode.ForwardDiagonal)
e.Graphics.FillRectangle(FillBrush, ClientRectangle)
FillBrush.Dispose()
End Sub
///

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Adam Maltby" <ad***@frfl.co.uk> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

But it going transparent all the way to the form background - i need it to transparent to the gradient I drew on the form.

Cheers
Adam
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.740 / Virus Database: 494 - Release Date: 16/08/2004
Nov 21 '05 #4

P: n/a
Excellent! Thanks a lot.
Still getting to grips with the overall options of graphics painting in vbnet (as you no doubt gathered) - that was a big help!

Thanks
Adam

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.