0

I am trying to create an application that takes plain text from a file, creates a formatted raster image of it and then flips it left to right for reading in a mirror. This is an auto-cue, tele-prompter application.

I can create the image with either Canvas and TextBlock, or Image(/Bitmap) and FormattedText but I can't then flip the image.

All my attempts, following the many paths illustrated in stack-exchange, have failed seemingly because they use classes provided in earlier versions of VS which no longer exist (in System.Drawing?). Some of the attempts say 'Not available in Windows Environment'.

I'm sure I must be missing something. Can anyone give me a pointer?

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
SolwiseMD
  • 69
  • 5
  • That sounds too complicated. Why don't you simply apply a ScaleTransform to the text element with either ScaleX set to `-1`? – Clemens Jan 15 '20 at 18:42
  • I started out aiming to use the ScaleX method but I have been unable to put the sequence of processes together to arrive at a class that offers it. Can you offer me some guidance on the sequence of classes I shoud use? – SolwiseMD Jan 17 '20 at 16:37

1 Answers1

1

You could have a simple TextBlock that is horizontally flipped by a ScaleTransform:

<TextBlock x:Name="textBlock">
    <TextBlock.LayoutTransform>
        <ScaleTransform ScaleX="-1"/>
    </TextBlock.LayoutTransform>
</TextBlock>

Assign text like

textBlock.Text = File.ReadAllText(path);
Clemens
  • 123,504
  • 12
  • 155
  • 268
  • Thanks for that, working well. The problem I'm having as a newcomer to .NET is finding groups of classes that work together. So, now I need to add a vertical scroll bar. How would I find the appropriate classes to use from the documentation? – SolwiseMD Jan 20 '20 at 12:30
  • You should take a look at some WPF tutorials, or even better, a book. I can recommend *WPF Unleashed* by Adam Nathan. – Clemens Jan 20 '20 at 13:34