CrazyTim
CrazyTim

Reputation: 7314

How do I create a font with semi-bold weight in VB.NET?

I wan't to create a semi-bold font in VB.NET.

Why isn't semi-bold available in intellisense?

[screenshot]

I am using .NET 4.5.

Upvotes: 1

Views: 3417

Answers (3)

webx.pl
webx.pl

Reputation: 21

Label1.Font = New Drawing.Font("Segoe UI Semibold", 10)

Add Semibold to font name.

Upvotes: 2

shf301
shf301

Reputation: 31394

System.Drawing.Fonts does not support a SemiBold setting weight. The FontWeights is in the System.Windows namespace which is WPF/Silveright - which does support Semi-Bold. However System.Drawing.Fonts is part of Windows Forms which does not.

WPF and Windows Forms use different rendering engines and are not compatible.

Upvotes: 1

Andre Figueiredo
Andre Figueiredo

Reputation: 13425

The answer is simple and is just available in front your eyes.

Just look with care the image you attached and MSDN Document:

System.Drawing.FontStyle is different from System.Windows.FontWeights.

A tip: no big deal, but for conscience' sake and future page visitors, you've cited something about .Net version 4.5... If you click on combo "Other versions", it will show the documentation page in others .Net versions.

So, in this case, System.Windows.FontWeights was introduced by .Net 3.0.

The more correct sentence is: .Net 3.0 (and up) is required to use System.Windows.FontWeights.

Upvotes: 1

Related Questions