TextElement.FontStretch Propiedad

Definición

Obtiene o establece las características de ajuste de fuentes para el contenido del elemento.

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

Valor de propiedad

FontStretch

Características de extensión de fuente deseadas que se van a usar. De manera predeterminada, es Normal.

Ejemplos

En el ejemplo siguiente se muestra cómo establecer el FontStretch atributo utilizando Paragraph como elemento de ejemplo.

<Paragraph
  FontFamily="Century Gothic, Courier New"  
  FontSize="16pt"
  FontStretch="UltraExpanded"
  FontStyle="Italic"
  FontWeight="DemiBold"
>
  <Run>
    This text will use the Century Gothic font (if available), with fallback to Courier New.  It 
    will render with a font size of 16 points in ultra-expanded demi-bold italic.
  </Run>
</Paragraph>

En la ilustración siguiente se muestra cómo se representa el ejemplo anterior.

Captura de pantalla: texto con las propiedades de texto establecidas

En el ejemplo siguiente se muestra cómo establecer la FontStretch propiedad mediante programación.

Run run = new Run(
    "This text will use the Century Gothic font (if available), with fallback to Courier New."
    + "It will render with a font size of 16 pixels in ultra-expanded demi-bold italic.");
Paragraph par = new Paragraph(run);

par.FontFamily = new FontFamily("Century Gothic, Courier New");
par.FontSize = 16;
par.FontStretch = FontStretches.UltraExpanded;
par.FontStyle = FontStyles.Italic;
par.FontWeight = FontWeights.DemiBold;
Dim run As New Run("This text will use the Century Gothic font (if available), with fallback to Courier New." & "It will render with a font size of 16 pixels in ultra-expanded demi-bold italic.")
Dim par As New Paragraph(run)

With par
    .FontFamily = New FontFamily("Century Gothic, Courier New")
    .FontSize = 16
    .FontStretch = FontStretches.UltraExpanded
    .FontStyle = FontStyles.Italic
    .FontWeight = FontWeights.DemiBold
End With

Comentarios

Esta propiedad de dependencia también tiene un uso de propiedad adjunta. En XAML, el uso es <object TextElement.FontStretch="value".../>, donde object es un elemento de objeto (normalmente un elemento flow) contenido dentro de , TextElementy value es uno de los nombres de propiedad de formato de cadena de la FontStretch clase. En el código, el uso de la propiedad adjunta es compatible con los GetFontStretch métodos y SetFontStretch . El uso de la propiedad adjunta no es común, ya que la mayoría de los elementos que se pueden contener en una TextElement propiedad análoga no adjunta FontStretch , que el host de contenido usa para la representación.

Información sobre propiedades de dependencia

Campo identificador FontStretchProperty
Propiedades de metadatos establecidas en true AffectsMeasure, AffectsRender, Inherits

Se aplica a