TextBlock.FontStretch Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau mengatur karakteristik peregangan font tingkat atas untuk TextBlock.
public:
property System::Windows::FontStretch FontStretch { System::Windows::FontStretch get(); void set(System::Windows::FontStretch value); };
public System.Windows.FontStretch FontStretch { get; set; }
member this.FontStretch : System.Windows.FontStretch with get, set
Public Property FontStretch As FontStretch
Nilai Properti
Anggota kelas yang FontStretch menentukan karakteristik peregangan font yang diinginkan untuk digunakan. Defaultnya adalah Normal.
Contoh
Contoh berikut menunjukkan cara mengatur FontStretch atribut TextBlock elemen.
<TextBlock
Name="textBlock"
Background="AntiqueWhite"
Foreground="Navy"
FontFamily="Century Gothic"
FontSize="12"
FontStretch="UltraExpanded"
FontStyle="Italic"
FontWeight="UltraBold"
LineHeight="Auto"
Padding="5,10,5,10"
TextAlignment="Center"
TextWrapping="Wrap"
Typography.NumeralStyle="OldStyle"
Typography.SlashedZero="True"
>
<Run Background="LightGreen">Text run 1.</Run>
<LineBreak/><Run Background="LightBlue">Text run 2.</Run>
<LineBreak/><Run Background="LightYellow">Text run 3.</Run>
</TextBlock>
Contoh berikut menunjukkan cara mengatur properti FontStretch secara terprogram.
TextBlock textBlock = new TextBlock(new Run("A bit of text content..."));
textBlock.Background = Brushes.AntiqueWhite;
textBlock.Foreground = Brushes.Navy;
textBlock.FontFamily = new FontFamily("Century Gothic");
textBlock.FontSize = 12;
textBlock.FontStretch = FontStretches.UltraExpanded;
textBlock.FontStyle = FontStyles.Italic;
textBlock.FontWeight = FontWeights.UltraBold;
textBlock.LineHeight = Double.NaN;
textBlock.Padding = new Thickness(5, 10, 5, 10);
textBlock.TextAlignment = TextAlignment.Center;
textBlock.TextWrapping = TextWrapping.Wrap;
textBlock.Typography.NumeralStyle = FontNumeralStyle.OldStyle;
textBlock.Typography.SlashedZero = true;
Dim textBlock As New TextBlock(New Run("A bit of text content..."))
textBlock.Background = Brushes.AntiqueWhite
textBlock.Foreground = Brushes.Navy
textBlock.FontFamily = New FontFamily("Century Gothic")
textBlock.FontSize = 12
textBlock.FontStretch = FontStretches.UltraExpanded
textBlock.FontStyle = FontStyles.Italic
textBlock.FontWeight = FontWeights.UltraBold
textBlock.LineHeight = Double.NaN
textBlock.Padding = New Thickness(5, 10, 5, 10)
textBlock.TextAlignment = TextAlignment.Center
textBlock.TextWrapping = TextWrapping.Wrap
textBlock.Typography.NumeralStyle = FontNumeralStyle.OldStyle
textBlock.Typography.SlashedZero = True
Keterangan
Pengaturan apa pun FontStretch pada elemen turunan mengambil alih pengaturan tingkat atas ini.
Properti dependensi ini juga memiliki penggunaan properti terlampir. Di XAML, penggunaannya adalah <object TextBlock.FontStretch="value".../>, di mana objek adalah elemen objek (biasanya elemen alur) yang terkandung dalam TextBlock, dan nilai adalah salah satu nama properti format string kelas FontStretch . Dalam kode, penggunaan properti terlampir didukung oleh GetFontStretch dan SetFontStretch. Penggunaan properti terlampir tidak umum, karena sebagian besar elemen yang dapat dimuat dalam TextBlock mendukung properti yang tidak terpasang FontStretch analog, yang digunakan untuk penyajian TextBlock .
Informasi Properti Dependensi
| Item | Nilai |
|---|---|
| Bidang pengidentifikasi | FontStretchProperty |
Properti metadata diatur ke true |
AffectsMeasure, , AffectsRenderInherits |