PC Review


Reply
Thread Tools Rate Thread

button font bold

 
 
anthony
Guest
Posts: n/a
 
      23rd Nov 2004
hi,

why can't i set the font of a button to bold at run time (it's read only), i
can only set at design time. it can be done in vb6.

thx


 
Reply With Quote
 
 
 
 
Chris, Master of all Things Insignificant
Guest
Posts: n/a
 
      23rd Nov 2004
You can, you just have to do it the same way that the designer does it.
Remember all the does designer is place code in the Web For Designer region,
you can go look in there to see what it does. In your case you have to make
a new font object and apply it to the button.

Hope it helps.
Chris
Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))


"anthony" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> hi,
>
> why can't i set the font of a button to bold at run time (it's read only),
> i
> can only set at design time. it can be done in vb6.
>
> thx
>
>



 
Reply With Quote
 
anthony
Guest
Posts: n/a
 
      23rd Nov 2004
thx, i should hv looked more b4 i posted, ur method works and i found this
too:

btnCalculateSpeed.Font = New Font(btnCalcBestTrip.Font, FontStyle.Bold)



"Chris, Master of all Things Insignificant" <chris@No_Spam_Please.com> wrote
in message news:uv%(E-Mail Removed)...
> You can, you just have to do it the same way that the designer does it.
> Remember all the does designer is place code in the Web For Designer

region,
> you can go look in there to see what it does. In your case you have to

make
> a new font object and apply it to the button.
>
> Hope it helps.
> Chris
> Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!,
> System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
> Byte))
>
>
> "anthony" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > hi,
> >
> > why can't i set the font of a button to bold at run time (it's read

only),
> > i
> > can only set at design time. it can be done in vb6.
> >
> > thx
> >
> >

>
>



 
Reply With Quote
 
Chris, Master of all Things Insignificant
Guest
Posts: n/a
 
      23rd Nov 2004
Yes there are several overloaded methods for making a font, any of them will
work to create the font object.

Good luck, happy fonting
Chris


"anthony" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> thx, i should hv looked more b4 i posted, ur method works and i found this
> too:
>
> btnCalculateSpeed.Font = New Font(btnCalcBestTrip.Font, FontStyle.Bold)
>
>
>
> "Chris, Master of all Things Insignificant" <chris@No_Spam_Please.com>
> wrote
> in message news:uv%(E-Mail Removed)...
>> You can, you just have to do it the same way that the designer does it.
>> Remember all the does designer is place code in the Web For Designer

> region,
>> you can go look in there to see what it does. In your case you have to

> make
>> a new font object and apply it to the button.
>>
>> Hope it helps.
>> Chris
>> Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!,
>> System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
>> CType(0,
>> Byte))
>>
>>
>> "anthony" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > hi,
>> >
>> > why can't i set the font of a button to bold at run time (it's read

> only),
>> > i
>> > can only set at design time. it can be done in vb6.
>> >
>> > thx
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      23rd Nov 2004
"anthony" <(E-Mail Removed)> schrieb:
> why can't i set the font of a button to bold at run time (it's read only),
> i
> can only set at design time.


\\\

' Adding bold style.
Me.Button1.Font = _
New Font(Me.Button1.Font, Me.Button1.Font.Style And Not FontStyle.Bold)

' Removing bold style.
Me.Button1.Font = _
New Font(Me.Button1.Font, Me.Button1.Font.Style Or FontStyle.Bold)
///

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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How to Make Bold a Command Button Bold If Related Table Has Data doyle60@aol.com Microsoft Access VBA Modules 0 3rd Mar 2009 07:56 PM
How to Make Bold a Command Button Bold If Related Table Has Data doyle60@aol.com Microsoft Access VBA Modules 1 3rd Mar 2009 06:26 PM
Incorrect Font Associated with Bold Button on Toolbar Al Microsoft Excel Misc 2 1st Dec 2007 06:11 PM
Re: Crash occurs with Font color or Bold toolbar button. Chris Campbell Microsoft Excel Crashes 2 15th Oct 2007 05:38 AM
user select font, font size, bold, etc Eric Microsoft Access Forms 3 31st Aug 2003 02:03 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:42 PM.