473,796 Members | 2,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How To Make Text Transparent [Win C#]

Can anyhow direct me on how to make text trasnparent. The Text is loctated
in my custom buttons. A Sample of my code is below.

Font fn = new Font("Tahoma",8 , System.Drawing. FontStyle.Bold) ;

string str= "Sauteed Spinach & Bacon";

StringFormat sf=(StringForma t)StringFormat. GenericTypograp hic.Clone();

sf.Alignment=St ringAlignment.C enter;

sf.LineAlignmen t=StringAlignme nt.Center;

sf.Trimming=Str ingTrimming.Ell ipsisWord;

myGraphics.Draw String(str, fn, Brushes.Black,n ew
RectangleF(5,5, this.ClientRect angle.Width-15,this.ClientR ectangle.Height-10),sf);

this.Region = new Region(myGraphi csPath);

fn.Dispose();

Thank you all in advance

MikeY
Oct 4 '06 #1
3 5150
You need to provide more info?

I presume you are creating your own component control and are inheriting
from Label? Then overriding the onPaint?

"MikeY" <mi*******@yaho .comwrote in message
news:%2******** **********@TK2M SFTNGP04.phx.gb l...
Can anyhow direct me on how to make text trasnparent. The Text is loctated
in my custom buttons. A Sample of my code is below.

Font fn = new Font("Tahoma",8 , System.Drawing. FontStyle.Bold) ;

string str= "Sauteed Spinach & Bacon";

StringFormat sf=(StringForma t)StringFormat. GenericTypograp hic.Clone();

sf.Alignment=St ringAlignment.C enter;

sf.LineAlignmen t=StringAlignme nt.Center;

sf.Trimming=Str ingTrimming.Ell ipsisWord;

myGraphics.Draw String(str, fn, Brushes.Black,n ew
RectangleF(5,5, this.ClientRect angle.Width-15,this.ClientR ectangle.Height-10),sf);

this.Region = new Region(myGraphi csPath);

fn.Dispose();

Thank you all in advance

MikeY


Oct 4 '06 #2
Just draw the text with a transparent brush such as
SolidBrush(Colo r.FromArgb,128, Color.Black))

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"MikeY" <mi*******@yaho .comwrote in message
news:%2******** **********@TK2M SFTNGP04.phx.gb l...
Can anyhow direct me on how to make text trasnparent. The Text is loctated
in my custom buttons. A Sample of my code is below.

Font fn = new Font("Tahoma",8 , System.Drawing. FontStyle.Bold) ;

string str= "Sauteed Spinach & Bacon";

StringFormat sf=(StringForma t)StringFormat. GenericTypograp hic.Clone();

sf.Alignment=St ringAlignment.C enter;

sf.LineAlignmen t=StringAlignme nt.Center;

sf.Trimming=Str ingTrimming.Ell ipsisWord;

myGraphics.Draw String(str, fn, Brushes.Black,n ew
RectangleF(5,5, this.ClientRect angle.Width-15,this.ClientR ectangle.Height-10),sf);

this.Region = new Region(myGraphi csPath);

fn.Dispose();

Thank you all in advance

MikeY


Oct 4 '06 #3
Thanks Bob.
"Bob Powell [MVP]" <bob@_spamkille r_.bobpowell.ne twrote in message
news:e8******** ******@TK2MSFTN GP03.phx.gbl...
Just draw the text with a transparent brush such as
SolidBrush(Colo r.FromArgb,128, Color.Black))

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"MikeY" <mi*******@yaho .comwrote in message
news:%2******** **********@TK2M SFTNGP04.phx.gb l...
>Can anyhow direct me on how to make text trasnparent. The Text is
loctated in my custom buttons. A Sample of my code is below.

Font fn = new Font("Tahoma",8 , System.Drawing. FontStyle.Bold) ;

string str= "Sauteed Spinach & Bacon";

StringFormat sf=(StringForma t)StringFormat. GenericTypograp hic.Clone();

sf.Alignment=S tringAlignment. Center;

sf.LineAlignme nt=StringAlignm ent.Center;

sf.Trimming=St ringTrimming.El lipsisWord;

myGraphics.Dra wString(str, fn, Brushes.Black,n ew
RectangleF(5,5 ,this.ClientRec tangle.Width-15,this.ClientR ectangle.Height-10),sf);

this.Region = new Region(myGraphi csPath);

fn.Dispose() ;

Thank you all in advance

MikeY



Oct 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
10178
by: Mark | last post by:
Hi All, I have a report which is based on a query which is used to produce QC check sheets. I have quite a few text boxes which are used to display questions depending on the value of one particular field which will have either a "H" or "B" value. e.g. =IIf(="H"," Does the multipack Qty match the paperwork"," Is the outer label positioned correctly") My problem is that there are more questions for hanging types than boxed.
3
36041
by: Ignacio Domínguez | last post by:
Hi there. I know I can make a form transparent by setting the transparent color, opacity, etc. Is there a way of making the background of a label and the background of a picturebox transparent also, so that I can place some text on top of an image (seing the image behind the text instead of the gray box of the label) and showing to the user only the image without the background of the picturebox or form, and the text over it? Any Ideas?...
2
6744
by: Simon Tamman {Uchiha Jax} | last post by:
I understand that MS made their controls annoyingly difficult to modify (for example transparency on a listbox, tab control, treeview etc) to ensure they didn't torpedo the third party control library industry (or is this just an excuse to fob us off with controls that are difficult to extend?). Therefore could anyone tell me of a company that offers decent transparent controls?
2
4580
by: anthonymelillo | last post by:
Is there a way to make the background of a text label transparent so that the image on the form behind can show through ? I can only seem to find out how to make the text background a color. Any help is greatly appreciated. Thank you Tony
0
3573
by: benfly08 | last post by:
Hi, guys. I'm developing a web application for Sales Department people in my company. I used my 1024X768 resolution and "Medium" IE text size to test my Layout and it worked fine. However, some people in Sales Department use different settings like "800X600", "Larger" IE text size or even "Large font" in Appearance tab in Display Property. Those different settings would mess up my layout. What I want to do is to set font size of labels,...
9
2109
by: GloStix | last post by:
Okay, when I click the link it dissapears and makes a white space underneath it but the space is clickable. so when you click the space, the link actually works Used Firefox 3.0 RC2 for this. OS X 10.5 http://www.screencast.com/t/wgztYUrdN (Video) http://www.jameswmann.com/music.htm (The actual page) HTML
2
5847
by: Warren Tang | last post by:
Hello, everyone Can I make a <input type="text"tag transparent? I mean I can see through it and see the background of its container. Regards Warren
3
4218
vdraceil
by: vdraceil | last post by:
Does anyone know hw to set the background icon text color(in win XP) to transparent?? I accidently changed it to some color and now it is possible to change to any other color,but not transparent..so how do i set it back to transparent? there is no restore default option too..
2
3485
by: neovantage | last post by:
Hey all, I have created transparent PNG images from text dynamically. But it edges are pixel-ate or we can say edges are distorted. Here is my LINK which shows my generated transparent PNG image. Can someone help me out to sort out my problem i will be very grateful to him as i am stuck bad with this issue and i am not figuring out how to fix this. Here is my Code which generate transparent PNG images <img...
0
9679
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10223
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10172
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.