wpf label font

http://stackoverflow.com/questions/637636/using-a-system-drawing-font-with-a-wpf-label

 

http://www.vistax64.com/avalon/88239-how-do-you-set-labels-font-underline-strikethrough.html

 

http://stackoverflow.com/questions/1464185/how-to-set-textblock-or-label-with-resizable-font-size-in-wpf

 

 

Set color:

Foreground="Red"

 

Set other things:

System.Drawing.Font font = FontFromLegacyCode();

System.Windows.Controls.Label label = new System.Windows.Controls.Label();
label
.FontFamily = new System.Windows.Media.FontFamily( font.Name );
label
.FontWeight = font.Bold ? System.Windows.FontWeights.Bold : System.Windows.FontWeights.Regular;
label
.FontStyle = font.Italic ? System.Windows.FontStyles.Italic : System.Windows.FontStyles.Normal;
label
.FontSize = font.Size;

<TextBlock Name="textBlock" TextDecorations="Underline, Strikethrough" />

<Label Name="label">
   
<TextBlock Name="textBlock" TextDecorations="Underline, Strikethrough" />
</Label>

你可能感兴趣的:(WPF)