Mega Code Archive

 
Categories / VB.Net / WPF
 

Use basic typographic properties

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   x:Class="Typography_Samp.Page1"   WindowTitle="Typography Variants Sample">   <FlowDocument Name="tf1" FontSize="18" ColumnWidth="600.0">     <Paragraph FontSize="20" Margin="0,0,0,10">Typography Variants Sample</Paragraph>     <Paragraph Margin="0,0,0,50">       this is a test     </Paragraph>     <Paragraph>       <StackPanel Orientation="Horizontal" Margin="10" HorizontalAlignment="Center">         <Button Click="changeArial">Arial</Button>         <Button Click="changePalatino">Palatino Linotype</Button>         <Button Click="changeTimes">Times New Roman</Button>         <Button Click="changeVerdana">Verdana</Button>       </StackPanel>       <LineBreak/>       Normal <Run Typography.Variants="Superscript">superscript</Run>       <Run Typography.Variants="Subscript">subscript</Run>       1<Run Typography.Variants="Ordinal">st</Run>       H<Run Typography.Variants="Inferior">2</Run>       SO<Run Typography.Variants="Inferior">4</Run>     </Paragraph>        </FlowDocument> </Page> //File:Window.xaml.vb Imports System Imports System.Windows Imports System.Windows.Controls Imports System.Windows.Media Namespace Typography_Samp   Public Partial Class Page1     Inherits Page     Public Sub changeArial(sender As Object, e As RoutedEventArgs)       tf1.FontFamily = New FontFamily("Arial")     End Sub     Public Sub changePalatino(sender As Object, e As RoutedEventArgs)       tf1.FontFamily = New FontFamily("Palatino Linotype")     End Sub     Public Sub changeTimes(sender As Object, e As RoutedEventArgs)       tf1.FontFamily = New FontFamily("Times New Roman")     End Sub     Public Sub changeVerdana(sender As Object, e As RoutedEventArgs)       tf1.FontFamily = New FontFamily("Verdana")     End Sub   End Class End Namespace