Object Transforms in WPF : Matrix3D « Windows Presentation Foundation « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » Windows Presentation Foundation » Matrix3DScreenshots 
Object Transforms in WPF
Object Transforms in WPF
  


<Window x:Class="WpfApplication1.ObjectMatrixTransforms"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Object Matrix Transforms" Height="300" Width="400">
  <StackPanel>
    <Button Click="BtnClose_Click" Margin="15,0,15,5">Close</Button>
    <Canvas Name="canvas1" ClipToBounds="True" Width="270" Height="280">
    <TextBlock Canvas.Top="53" Canvas.Left="90">Original shape</TextBlock>
    <Rectangle Canvas.Top="70" Canvas.Left="100" Width="50" Height="70" Stroke="Black" StrokeThickness="2"
            StrokeDashArray="3,1" />
    <Rectangle Name="rect" Canvas.Top="70" Canvas.Left="100" Width="50" Height="70" Fill="LightCoral"
            Opacity="0.5" Stroke="Black" StrokeThickness="2">
        <Rectangle.RenderTransform>
          <MatrixTransform x:Name="matrixTransform" />
        </Rectangle.RenderTransform>
    </Rectangle>
    </Canvas>
  </StackPanel>
</Window>
//File:Window.xaml.cs

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;

namespace WpfApplication1
{
    public partial class ObjectMatrixTransforms : Window
    {
        public ObjectMatrixTransforms()
        {
            InitializeComponent();
        }
        public void BtnApply_Click(object sender, EventArgs e)
        {
            Matrix m = new Matrix();
            m.M11 = 1;
            m.M12 = 0;
            m.M21 = 0;
            m.M22 = 1;
            m.OffsetX = 1;
            m.OffsetY = 2;
            matrixTransform.Matrix = m;
        }

    }
}

   
    
  
Related examples in the same category
1.Matrix3D scale transformationMatrix3D scale transformation
2.Matrix3D ScalePrependMatrix3D ScalePrepend
3.Matrix3D TranslationMatrix3D Translation
4.Matrix3D TranslatePrependMatrix3D TranslatePrepend
5.Matrix3D RotateMatrix3D Rotate
6.Matrix3D RotateAtMatrix3D RotateAt
7.Matrix3D RotateAtPrependMatrix3D RotateAtPrepend
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.