Benutzer:MovGP0/WPF/Transforms

aus Wikipedia, der freien Enzyklopädie
< Benutzer:MovGP0‎ | WPF
Dies ist die aktuelle Version dieser Seite, zuletzt bearbeitet am 23. November 2015 um 13:40 Uhr durch imported>MovGP0(77247) (→‎Bitmap Effects).
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
   MovGP0        Über mich        Hilfen        Artikel        Weblinks        Literatur        Zitate        Notizen        Programmierung        MSCert        Physik      


WPF Transforms

Elemets with Transformations
  • Geometry
  • Brush
    • RelativeTransform
    • Transform
  • FrameworkElement
    • RenderTransform-Property
      (transformation without adjusting)
    • LayoutTransform-Property
      (adjusting the size of the object to fit inside the parent)
Transformations
  • ScaleTransform
  • TranslateTransform
  • RotateTransform
  • SkewTransform
  • TransformGroup
  • MatrixTransform

Clipping

Cuts off everything outside of the clipping area.

<Button>
  <Button.Clip>
    <EllipseGeometry Center="28,12" RadiusX="30" RadiusY="10" />
  </Button.Clip>
</Button>

Opacity Mask

Defines a gradient for transparency.

<Button>
  <Button.OpacityMask>
    <RadialGradientBrush>
      <GradientStop Color="Transparent" Offset="0" />
      <GradientStop Color="White" Offset="0.4" />
      <GradientStop Color="White" Offset="0.8" />
      <GradientStop Color="Transparent" Offset="1" />
    </RadialGradientBrush>
  </Button.OpacityMask>
</Button>

Bitmap Effects

  • renders in Software before .NET 3.5
  • implemented as GPU shaders in .NET 3.5+
    • custom shaders are possible
Effects
  • DropShadowBitmapEffect
  • BlurBitmapEffect
  • EmbossBitmapEffect
  • BevelBitmapEffect
  • OuterGlowBitmapEffect
  • BitmapEffectGroup

Animation

  • can animate any property of an FrameworkElement
<Rectangle Fill="Green" HorizontalAlignment="Left" Height="24">
  <Rectangle.Triggers>
    <EventTrigger RoutedEvent="Rectangle.Loaded">
      <BeginStoryboard>
        <Storyboard>
          <DoubleAnimation From="10.0" To="100,0" Duration="0:0:10" 
                           Storyboard.TargetProperty="(Rectangle.Width)" />
        </Storyboard>
      </BeginStoryboard>
    </EventTrigger>
  <Rectangle.Triggers>
</Rectangle>