button font bold

  • Thread starter Thread starter anthony
  • Start date Start date
A

anthony

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
 
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))
 
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)
 
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 said:
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)
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top