====== 005 文字列の表示 ====== {{:wiki:windowsphone:7.1:tips:w_phone_005_001.png?200|}} ===== 概要 ===== フォントを作成し文字列を表示します。 ==== MainPage.xaml ==== ==== MainPage.xaml.cs ==== using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Microsoft.Phone.Controls; namespace BaseApp { // エントリーポイント public partial class MainPage : PhoneApplicationPage { // コンストラクタ public MainPage() { // コンポーネントの初期化。 InitializeComponent(); // 文字列の表示。 TextBlock textBlock0 = new TextBlock(); textBlock0.FontFamily = new FontFamily("MS ゴシック"); // フォントタイプ。 textBlock0.FontSize = 32; // フォントサイズ。 textBlock0.FontStretch = FontStretches.Normal; // 伸縮率。 textBlock0.FontStyle = FontStyles.Italic; // フォントスタイル。 textBlock0.FontWeight = FontWeights.Bold; // フォントスタイル。 SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)); textBlock0.Foreground = brush; textBlock0.Text = "ウインドウズ フォン!"; LayoutRoot.Children.Add( textBlock0 ); } } }