473,699 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Font to bold, italic, underline only

Okay,

Assinging the font and its style (bold, italic etc.) using the font dialog
is easy such as:
FontDialog1.Sho wDialog()

txtEmailBody.Se lectionFont = FontDialog1.Fon t

But how does one change the selected text to bold, italic or underlined
without using the font dialog?

I've looked under .selectionfont and.selectedtex t and can't see any way to
change it to bold, italic etc. All I see is a read-only property that tells
me if its bold, italic etc.

There's go to be a way. All these apps have these small B, I, U buttons.

Initialize a font, tweak it and assign it? Is that really the only way?

Thanks,

Adam


May 7 '06 #1
2 2862
"Adam Honek" <Ad*******@Webm aster2001.frees erve.co.uk> schrieb:
Assinging the font and its style (bold, italic etc.) using the font dialog
is easy such as:
FontDialog1.Sho wDialog()

txtEmailBody.Se lectionFont = FontDialog1.Fon t

But how does one change the selected text to bold, italic or underlined
without using the font dialog?

I've looked under .selectionfont and.selectedtex t and can't see any way to
change it to bold, italic etc. All I see is a read-only property that
tells me if its bold, italic etc.


Removing a certain font style:

\\\
EmailBody.Selec tionFont = _
New Font( _
EmailBody.Selec tionFont, _
EmailBody.Selec tionFont.Style And Not FontStyle.Bold _
)
///

Adding a font style: '... = New Font(..., EmailBody.Selec tionFont Or
FontStyle.Bold) '.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

May 7 '06 #2
Thanks, it worked and could equally do underline, italic the same way.
Thanks.

Adam

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:O0******** ******@TK2MSFTN GP03.phx.gbl...
"Adam Honek" <Ad*******@Webm aster2001.frees erve.co.uk> schrieb:
Assinging the font and its style (bold, italic etc.) using the font
dialog is easy such as:
FontDialog1.Sho wDialog()

txtEmailBody.Se lectionFont = FontDialog1.Fon t

But how does one change the selected text to bold, italic or underlined
without using the font dialog?

I've looked under .selectionfont and.selectedtex t and can't see any way
to change it to bold, italic etc. All I see is a read-only property that
tells me if its bold, italic etc.


Removing a certain font style:

\\\
EmailBody.Selec tionFont = _
New Font( _
EmailBody.Selec tionFont, _
EmailBody.Selec tionFont.Style And Not FontStyle.Bold _
)
///

Adding a font style: '... = New Font(..., EmailBody.Selec tionFont Or
FontStyle.Bold) '.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

May 7 '06 #3

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

Similar topics

14
2655
by: Viken Karaguesian | last post by:
Hello all, It stinks being a newbie! One thing that I'm not sure about with CSS is: where is the "proper" place to put font attibutes? This has me a little confused. Take the below style sheet (which is a work in progress) as an example. If I don't put the font attributes in the <body> <p> and <td> tags, the font will not appear the way I want (when I work in FrontPage, anyway). It doesn't seem to be enough to put the font attributes in...
7
1689
by: Derrick | last post by:
Can anyone tell me how to persist and retrieve the font characteristics that a user chooses to have displayed in a personalized label field on the front of their application? I wanted to be able to give the user this ability so that they could place a company logo, motto, or simply a message of the day on the form, and have it redisplay from then on at start up just as it was to begin with. I was trying to use an .rtf file to store the...
0
1272
by: silverprox | last post by:
Hi, I'm developing a simple composite control with 2 child controls, a Label and a TextBox. I expose easily many properties of the inner controls, in the form i.e.: BoxToolTip & LabelToolTip, BoxForeColor & LabelForeColor, BoxCssClass & labelCssClass... but when I try to insert the BoxFont & LabelFont properties,
1
1140
by: shachar | last post by:
hi all. i have a grid ocx i'm using, and i have to set it's font to an integer value returning from a font object. when i wrote : Dim f As System.Drawing.Font al it's propertys are readonly. how can i set it's Bold,Underline etc..
7
2965
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and already formatted as "Shopping" ---Bold "for" -----Regular Now I want to underline whole text by preserving old style i.e. Bold and
1
1700
by: Gidi | last post by:
Hi, Is it possible to draw string with few font styls, like in WORD (i.e. Bold and Underline) at the same line, on the same text ? and is it possible that part of the line will be bold and the other one not ? Thanks, Gidi.
0
1396
by: the.tinapatel | last post by:
Guys, I want the user to be able to select font (such as Bold, Italic, underline) and stuff like that from a dropdown list) and then I wanna apply these properties to all my page (all text). Now I'm doing something like this: string font = string.Empty; switch(ddl2.SelectedItem.Text) {
1
8635
by: FLEMEF | last post by:
Hello All, I'm not very good at Java... With this piece of Java code, how could I modify the StyleOptions.java program to allow the user to specify the size of the font, while using the text field to obtain the user’s input. Thanks. ----------------------------------------------------------------- import javax.swing.*; import java.awt.*; import java.awt.event.*;
0
8686
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
8615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9173
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8911
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
7748
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6533
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5872
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4375
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...
3
2009
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.