ScaleTransform Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Met à l’échelle un objet dans le système de coordonnées x-y bidimensionnel.
public ref class ScaleTransform sealed : Transform
/// [Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.WinUIContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ScaleTransform final : Transform
[Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.WinUIContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ScaleTransform : Transform
Public NotInheritable Class ScaleTransform
Inherits Transform
<ScaleTransform .../>
- Héritage
- Attributs
Exemples
Cet exemple XAML utilise un ScaleTransform pour mettre à l’échelle du texte à partir de sa taille d’origine.
<StackPanel>
<TextBlock FontFamily="Verdana"
FontSize="32"
FontWeight="Bold"
Foreground="SteelBlue"
Text="Scaled Text" />
<!-- Scale the text width using a ScaleTransform. -->
<TextBlock FontFamily="Verdana"
FontSize="32"
FontWeight="Bold"
Foreground="SteelBlue"
Text="Scaled Text">
<TextBlock.RenderTransform>
<ScaleTransform ScaleX="1.5" ScaleY="1.0" />
</TextBlock.RenderTransform>
</TextBlock>
<!-- Scale the text height using a ScaleTransform. -->
<TextBlock FontFamily="Verdana"
FontSize="32"
FontWeight="Bold"
Foreground="SteelBlue"
Text="Scaled Text">
<TextBlock.RenderTransform>
<ScaleTransform ScaleX="1.0" ScaleY="2.0" />
</TextBlock.RenderTransform>
</TextBlock>
</StackPanel>
Le texte ressemble à ceci après l’application de la transformation :
Cet exemple montre comment accéder à une transformation et la modifier au moment de l’exécution. Chaque fois que le rectangle est enfoncé, l’échelle est augmentée.
<StackPanel>
<Rectangle PointerPressed="HandlePointerPressed"
Width="50" Height="50" Fill="RoyalBlue">
<Rectangle.RenderTransform>
<!-- If you give the transform a name you can
access it easily from code. -->
<ScaleTransform x:Name="myScaleTransform" />
</Rectangle.RenderTransform>
</Rectangle>
</StackPanel>
private void HandlePointerPressed(object sender, PointerRoutedEventArgs e)
{
// Increase ScaleX and ScaleY by 25%.
myScaleTransform.ScaleX = myScaleTransform.ScaleX * 1.25;
myScaleTransform.ScaleY = myScaleTransform.ScaleY * 1.25;
}
Constructeurs
| Nom | Description |
|---|---|
| ScaleTransform() |
Initialise une nouvelle instance de la classe ScaleTransform . |
Propriétés
| Nom | Description |
|---|---|
| CenterX |
Obtient ou définit la coordonnée x du point central de ce ScaleTransform. |
| CenterXProperty |
Identifie la propriété de dépendance CenterX . |
| CenterY |
Obtient ou définit la coordonnée y du point central de ce ScaleTransform. |
| CenterYProperty |
Identifie la propriété de dépendance CenterY . |
| Dispatcher |
Retourne |
| DispatcherQueue |
Obtient le |
| Inverse |
Obtient la transformation inverse de ce GeneralTransform, si possible. (Hérité de GeneralTransform) |
| InverseCore |
Implémente le comportement pour la valeur de retour inverse dans un GeneralTransform dérivé ou personnalisé. (Hérité de GeneralTransform) |
| ScaleX |
Obtient ou définit le facteur d’échelle de l’axe x. |
| ScaleXProperty |
Identifie la propriété de dépendance ScaleX . |
| ScaleY |
Obtient ou définit le facteur d’échelle de l’axe y. |
| ScaleYProperty |
Identifie la propriété de dépendance ScaleY . |
Méthodes
| Nom | Description |
|---|---|
| ClearValue(DependencyProperty) |
Efface la valeur locale d’une propriété de dépendance. (Hérité de DependencyObject) |
| GetAnimationBaseValue(DependencyProperty) |
Retourne toute valeur de base établie pour une propriété de dépendance, qui s’applique dans les cas où une animation n’est pas active. (Hérité de DependencyObject) |
| GetValue(DependencyProperty) |
Retourne la valeur effective actuelle d’une propriété de dépendance à partir d’un DependencyObject. (Hérité de DependencyObject) |
| ReadLocalValue(DependencyProperty) |
Retourne la valeur locale d’une propriété de dépendance, si une valeur locale est définie. (Hérité de DependencyObject) |
| RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback) |
Inscrit une fonction de notification pour écouter les modifications apportées à une dependencyProperty spécifique sur cette instance DependencyObject . (Hérité de DependencyObject) |
| SetValue(DependencyProperty, Object) |
Définit la valeur locale d’une propriété de dépendance sur un DependencyObject. (Hérité de DependencyObject) |
| TransformBounds(Rect) |
Transforme le cadre englobant spécifié et retourne un cadre englobant aligné sur l’axe qui est exactement suffisamment grand pour le contenir. (Hérité de GeneralTransform) |
| TransformBoundsCore(Rect) |
Fournit les moyens de remplacer le comportement TransformBounds dans une classe de transformation dérivée. (Hérité de GeneralTransform) |
| TransformPoint(Point) |
Utilise la logique de cet objet de transformation pour transformer le point spécifié et retourne le résultat. (Hérité de GeneralTransform) |
| TryTransform(Point, Point) |
Tente de transformer le point spécifié et retourne une valeur qui indique si la transformation a réussi. (Hérité de GeneralTransform) |
| TryTransformCore(Point, Point) |
Fournit les moyens de remplacer le comportement TryTransform dans une classe de transformation dérivée. (Hérité de GeneralTransform) |
| UnregisterPropertyChangedCallback(DependencyProperty, Int64) |
Annule une notification de modification qui a été précédemment inscrite en appelant RegisterPropertyChangedCallback. (Hérité de DependencyObject) |