473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Need transparent label but with a slight difference

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
4 1464
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Paul Schnitter | last post by:
Update: My custom control is based on the article "Creating Visual Basic .NET controls from scratch" in "Adventures in .NET" on MSDN. It is designed to be a replacement for the VB6 shape...
3
by: SStory | last post by:
Is there no way to make a label or link label transparent in vb.net? This is a real pain on about screens with nice graphics where you want your text backgroup to be transparent. I can...
4
by: jcrouse | last post by:
I am using the following code to move a label on a form at runtime: If myMousedown = lblP1JoyRight.Name Then If lblP1JoyRight.BackColor.Equals(Color.Transparent) Then bTransCk = True ...
1
by: Dean Slindee | last post by:
The code below runs in the form_paint event but changes nothing, anyone got a better idea or why this code is not effective? Imports System.Drawing.Drawing2D Dim ctl As Control Dim str As...
2
by: Dean Slindee | last post by:
It appears that I have two routines that don't play well together! First routine: a form's background is shaded with a gradient color. Second routine: then, the background of all labels on the...
2
by: UJ | last post by:
I have a browser object on a form with a label in front of it. I want the label to be transparent so that you can see what's going on in the browser behind it. When I make the label transparent...
2
by: Martin | last post by:
I've been complaing about the VB2005 Help-Information (or rather the lack of it) before, but when I was looking how to set the backstyle of a label control to "Transparent" I found that the VB2005...
3
by: vul | last post by:
I used to use creating headers (label at the top of the screen) for VB6 forms as 2 labels shifted a little bit with different for colors to get a simulation of a shadow. I set BackColor of both...
8
by: MikeB | last post by:
Hi, I created a picturebox with a map as an image. I want to make certain areas on the map clickable hotspots and the way I'm trying to do this is to create a transparent label with a different...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.