473,414 Members | 1,757 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,414 software developers and data experts.

RickTextBox font properties

Hello,

I have a rich textbox on my form and I want the user to be able
to select the font properties via the font dialog box.

1) How do I bring up the font dialog box in the code?
2) How do I make the settings on it affect the rich textbox in question?

Many thanks,
Adam Honek
Nov 21 '05 #1
4 1548
"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schrieb:
I have a rich textbox on my form and I want the user to be able
to select the font properties via the font dialog box.

1) How do I bring up the font dialog box in the code?
2) How do I make the settings on it affect the rich textbox in question?


Add a richtextbox and a fontdialog component to your form, then place the
code below in a button's 'Click' event handler:

\\\
If Me.FontDialog1.ShowDialog() = DialogResult.OK Then
Me.RichTextBox1.SelectionFont = Me.FontDialog1.Font
End If
///

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

Nov 21 '05 #2
Thanks for this.

It works but there is only 1 bug.

It seems that the rich text box reverts to its original font the second time
something is displayed in it.

So for example we send "blahblah" to it and then send "some text" the latter
will appear in the original font.

Adam

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eT**************@TK2MSFTNGP14.phx.gbl...
"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schrieb:
I have a rich textbox on my form and I want the user to be able
to select the font properties via the font dialog box.

1) How do I bring up the font dialog box in the code?
2) How do I make the settings on it affect the rich textbox in question?


Add a richtextbox and a fontdialog component to your form, then place the
code below in a button's 'Click' event handler:

\\\
If Me.FontDialog1.ShowDialog() = DialogResult.OK Then
Me.RichTextBox1.SelectionFont = Me.FontDialog1.Font
End If
///

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

Nov 21 '05 #3
"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schrieb:
It seems that the rich text box reverts to its original font the second
time something is displayed in it.

So for example we send "blahblah" to it and then send "some text" the
latter will appear in the original font.


Either assign the selected font to the richtextbox's 'Font' property or
select the whole text and apply the font.

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

Nov 21 '05 #4
Right done that and it works now.

The only problem now would be that the font affects all the text instead of
just
the own users text.

The app is a kind of chat app allowing admins to communicate between each
other.

Thanks,
Adam

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schrieb:
It seems that the rich text box reverts to its original font the second
time something is displayed in it.

So for example we send "blahblah" to it and then send "some text" the
latter will appear in the original font.


Either assign the selected font to the richtextbox's 'Font' property or
select the whole text and apply the font.

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

Nov 21 '05 #5

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

Similar topics

6
by: Csaba2000 | last post by:
How do I detect when the font size has been changed (especially by user action: either Ctrl+Scroll wheel or View/Text Size)? This is just for use on IE 5.5+, but it would be great if there was a...
131
by: Peter Foti | last post by:
Simple question... which is better to use for defining font sizes and why? px and em seem to be the leading candidates. I know what the general answer is going to be, but I'm hoping to ultimately...
7
by: Fabian Neumann | last post by:
Hi! I got a problem with font-family inheritance. Let's say I have CSS definitions like: p { font:normal 10pt Verdana; } strong { font:normal 14pt inherit;
16
by: Coder Droid | last post by:
I'm trying my first table-less site, and I've bumped my head up against a wall. I can't change the font size within a div. Real quick, my style sheet has: -------------------------------------...
14
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...
2
by: Amith | last post by:
Hi, I am using an ActiveX created using delphi. It has a font property exposed. The font property is of type IFontDisp in the server(delphi). The font properties like Size, Bold, Underline etc...
7
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...
2
by: Patti | last post by:
I am building an application using VB.NET 1.1 and I have an issue with Font properties in my Radio Button Lists and Check Box Lists. My issue is that the Font Names and Font Size for these...
8
by: Andrus | last post by:
I have class FormData { public System.Drawing.Font TextBoxFont; } I need to read/store this class in isolated storage in Winforms application. Using
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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.