473,418 Members | 2,037 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,418 software developers and data experts.

Dynamic Font change for buttons

Jim
Working with VB.net under VS.Net 2003.

Have a simple form with a Button1. I want to change the
font on the button when the button is clicked.

Is there a way to Dynamically change the Font for Button1
from regular to bold, change the size etc. This line of
code:
Button1.Font.Bold = True

gives an error:
property is read only.

I know it can be changed in the designer, but the users
would like some further emphasis in the button label if
the button has been clicked.

What am I missing?

Thanks
Nov 21 '05 #1
2 16166
Button1.Font = New Font(Button1.Font, FontStyle.Bold)

Button1.Font = New Font(Button1.Font, FontStyle.Bold Or FontStyle.Italic)

The properties of Button.Font are read-only. So if you need to change any
properties, just create a new font from the existing one with the changed
property(ies) and assign it to Button.font.

hope that helps..
Imran.

"Jim" <an*******@discussions.microsoft.com> wrote in message
news:11****************************@phx.gbl...
Working with VB.net under VS.Net 2003.

Have a simple form with a Button1. I want to change the
font on the button when the button is clicked.

Is there a way to Dynamically change the Font for Button1
from regular to bold, change the size etc. This line of
code:
Button1.Font.Bold = True

gives an error:
property is read only.

I know it can be changed in the designer, but the users
would like some further emphasis in the button label if
the button has been clicked.

What am I missing?

Thanks

Nov 21 '05 #2
Thanks - that works.
-----Original Message-----
Button1.Font = New Font(Button1.Font, FontStyle.Bold)

Button1.Font = New Font(Button1.Font, FontStyle.Bold Or FontStyle.Italic)
The properties of Button.Font are read-only. So if you need to change anyproperties, just create a new font from the existing one with the changedproperty(ies) and assign it to Button.font.

hope that helps..
Imran.

"Jim" <an*******@discussions.microsoft.com> wrote in messagenews:11****************************@phx.gbl...
Working with VB.net under VS.Net 2003.

Have a simple form with a Button1. I want to change the
font on the button when the button is clicked.

Is there a way to Dynamically change the Font for Button1 from regular to bold, change the size etc. This line of
code:
Button1.Font.Bold = True

gives an error:
property is read only.

I know it can be changed in the designer, but the users
would like some further emphasis in the button label if
the button has been clicked.

What am I missing?

Thanks

.

Nov 21 '05 #3

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

Similar topics

0
by: hzgt9b | last post by:
Using VS 2003, VB.NET: I have a TreeView control filled with TreeNodes. When I create the TreeView, I set HotTracking = True. Subsequently, I change the font (make the not bold versus bold) on...
6
by: Mason A. Clark | last post by:
I came upon this trick: a usemap with two buttons for changing the page's font size: ============ <map name="fontmap" id="fontmap"> <area shape="rect" coords="111,1,126,15"...
2
by: Hariharan S | last post by:
Hi Guys, Have an issue with the Font object. I have a text box in which I can enter text and I have included a small button which upon selection, should enable me to change the newly entered...
0
by: Dan Neely | last post by:
Winform labels, buttons, etc don't respond to the normal/large/extra large font settings that can be specified in display properties. Is there an easy way to do an appwide detection+change at...
0
by: RSB | last post by:
Hi Every one, i am trying to create a UserControl and i am passing a Array of strings to it. Now based on the Array elements i am creating the LinkButtons Dynamically. I am also passing a Event to...
1
by: Rajesh Joshi | last post by:
How to Change Datagrid's Column font change for a column. and How fill Msflexgrid fill with particular Recordset at runtime.
1
by: Lennart Nielsen | last post by:
How do you change the font size dynamically in a single selected cell? Lennart
22
by: Saul | last post by:
I have a set of radio buttons that are created dynamically, after rendered I try loop thru this set by getting the length of the set, but I keep getting an error stating the element is undefined. I...
0
by: Dhans | last post by:
I have a MDI Application. From the container form I am setting the font for the each controls in the MDI Child form. If I increase the size of the font greater than the default, the text in each...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
0
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...

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.