PC Review


Reply
Thread Tools Rate Thread

DrawingContext + Transform issue

 
 
Anthony Paul
Guest
Posts: n/a
 
      15th Nov 2010
Hello everyone,

I have an issue where I'm creating a visuals container to host some
lightweight visuals, but when I apply transforms to the individual
visuals they go buggers.

First, I downloaded the MS sample code located at the bottom of the
following page :

http://msdn.microsoft.com/en-us/libr...ollection.aspx

I modify the "CreateDrawingVisualText" and add the following line
right after the call to RenderOpen :

drawingContext.PushTransform(new ScaleTransform(-1, 1, 0.5, 0.5)); //
inverts horizontally

and finally add the following line right before the call to Close :

drawingContext.Pop();

The method should now look as follows :

private DrawingVisual CreateDrawingVisualText()
{
// Create an instance of a DrawingVisual.
DrawingVisual drawingVisual = new DrawingVisual();

// Retrieve the DrawingContext from the DrawingVisual.
DrawingContext drawingContext =
drawingVisual.RenderOpen();
drawingContext.PushTransform(new ScaleTransform(-1, 1,
0.5, 0.5));

// Draw a formatted text string into the DrawingContext.
drawingContext.DrawText(
new FormattedText("Click Me!",
CultureInfo.GetCultureInfo("en-us"),
FlowDirection.LeftToRight,
new Typeface("Verdana"),
36, System.Windows.Media.Brushes.Black),
new System.Windows.Point(200, 116));

// Close the DrawingContext to persist changes to the
DrawingVisual.
drawingContext.Pop();
drawingContext.Close();

return drawingVisual;
}

note : feel free to try any type of transform; they simply won't work!

Any thoughts?

Regards,

Anthony
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue with transform query Jack Microsoft Access VBA Modules 2 7th Aug 2009 04:34 AM
XML XSLT Transform issue please help =?Utf-8?B?QnJpYW5ESA==?= Microsoft C# .NET 3 1st Mar 2006 07:37 PM
Transform Statement Issue =?Utf-8?B?bWNnag==?= Microsoft Access Queries 4 16th Jul 2005 06:48 PM
issue using XML transform amessimon Microsoft ASP .NET 1 19th Nov 2004 04:11 PM
Transform/Pivot SQL issue with form value Ron Microsoft Access Queries 0 7th Aug 2003 07:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:20 AM.