Smrf.NodeXL.Visualization.Wpf.NodeXLControl.CreateTransforms C# (CSharp) Method

CreateTransforms() protected method

protected CreateTransforms ( ) : void
return void
    CreateTransforms()
    {
        // The zoom is controlled by a ScaleTransform used as the first of two
        // render transforms.  If its ScaleX and ScaleY properties are set to
        // 2.0, for example, the graph is rendered twice as large as normal and
        // doesn't fit within the control.
        //
        // This ScaleTransform does not affect the ActualWidth and ActualHeight
        // properties.

        TransformGroup oTransformGroup = new TransformGroup();

        oTransformGroup.Children.Add( new ScaleTransform() );

        // The zoom center is controlled by a TranslateTransform used as a
        // second render transform.  If its X property is set to -100, for
        // example, then the graph, which has been scaled by the group's first
        // transform, is translated to the left by 100 scaled units.

        oTransformGroup.Children.Add( new TranslateTransform() );

        this.RenderTransform = oTransformGroup;

        // Note that mouse coordinates as reported by
        // MouseEventArgs.GetLocation() are affected by both transforms.
        // Because of this, it is sometimes more convenient to convert the
        // mouse coordinates to screen coordinates, which are not affected by
        // any of the transforms.
    }
NodeXLControl