3

At the moment I am working with C# and WPF and I want to create a multi-user application. I am pointing to multitouch tables.

I am looking for a way to have multiple Windows keyboard which can be rotated.

I want to use the Windows keyboard because it is impossible for me to create the different keyboards for every language including chinese, russian, japanese, greek etc.

To show a keyboard I use:

Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.System) + System.IO.Path.DirectorySeparatorChar + "osk.exe"); 

Below an example of what I want.

Multiple keyboards

Ron van der Heijden
  • 14,803
  • 7
  • 58
  • 82
  • You are not going to get this from osk.exe, it was made for desktop machines. Ask at superuser for utilities that flip the entire screen. You otherwise ought to be looking at a mobile development environment. WinRT, not WPF. – Hans Passant Aug 15 '13 at 12:11
  • Also I am using a desktop machine. When looking at [this app](http://www.codeproject.com/Articles/498623/Multi-language-on-screen-keyboa) I still got the feeling that I can acchieve something like that. He is using the dll of windows and use a WPF. Can't I do something simulair? Or load an .exe in a frame and rotate the frame. BTW, this is my first C# application :) – Ron van der Heijden Aug 15 '13 at 12:25
  • Do I understand correctly that you want to rotate 180° on the keyboard control? – Anatoliy Nikolaev Aug 15 '13 at 16:54
  • @AnatoliyNikolaev Yes, 90° also, when a user is standing at the left or right side of the table. – Ron van der Heijden Aug 16 '13 at 07:21
  • `user is standing at the left or right side` - This will you determine? I just can show how *only* it is to rotate the control. – Anatoliy Nikolaev Aug 16 '13 at 08:16
  • To clarify, I have a multi user application using a multi touch table. Users can stand around the table and (in this example) browser on the internet. So like in my image (2 users at each side) or 4 users on every side. A possibility to rotate the keyboard is what I am looking for (and the possibility to have multiple keyboards). In this example I would only use 90° rotation. – Ron van der Heijden Aug 16 '13 at 09:25

1 Answers1

1

In WPF with RenderTransform can rotate controls approximately in this way:

<Label Width="50" Height="20">
    <Label.RenderTransform>
        <RotateTransform Angle="90" />
    </Label.RenderTransform>
</Label>

In this case the Label is rotated by 90 degrees. But objects of the Window can not be rotated because the Window chrome is still rendered by GDI right now.

In your case, I can advise to find / create / etc keyboard control for WPF that matched your requirements. For example, I found such a control by link:

enter image description here

To add to the rotation of the control, I added two buttons: RotateOn180 and RotateOn360 in VirtualKeyboard.xaml. The keyboard itself is in the dock panel, so I wrote this:

<DockPanel Width="500" Height="200" RenderTransformOrigin="0.5,0.5">
    <DockPanel.RenderTransform>
        <RotateTransform x:Name="KeyboardRotation" Angle="0"/>
    </DockPanel.RenderTransform>

    ....

By clicking the button starts the animation, which changes the angle of rotation. Full additional code:

<Grid>
    <Grid.Triggers>
        <EventTrigger SourceName="RotateOn180" RoutedEvent="Button.Click">
            <BeginStoryboard>
                <Storyboard Storyboard.TargetName="KeyboardRotation" Storyboard.TargetProperty="Angle">
                    <DoubleAnimation From="0" To="180" Duration="0:0:0.5" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>

        <EventTrigger SourceName="RotateOn360" RoutedEvent="Button.Click">
            <BeginStoryboard>
                <Storyboard Storyboard.TargetName="KeyboardRotation" Storyboard.TargetProperty="Angle">
                    <DoubleAnimation From="180" To="360" Duration="0:0:0.5" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Grid.Triggers>

    <Button Name="RotateOn180" Content="RotateOn180" Width="80" Height="30" HorizontalAlignment="Left" />
    <Button Name="RotateOn360" Content="RotateOn360" Width="80" Height="30" HorizontalAlignment="Left" Margin="0,80,0,0" />

    <DockPanel Width="500" Height="200" RenderTransformOrigin="0.5,0.5">
        <DockPanel.RenderTransform>
            <RotateTransform x:Name="KeyboardRotation" Angle="0"/>
        </DockPanel.RenderTransform>

    ...Below is a standard code of project...

Output

enter image description here

Anatoliy Nikolaev
  • 22,370
  • 15
  • 69
  • 68
  • Thanks! I am using this keyboard http://lars.werner.no/?page_id=922 but I am unable to load this C++ application in a WPF. Could you point me in the right direction? – Ron van der Heijden Aug 16 '13 at 11:03
  • @Bondye: Unfortunately, I can not precisely tell for this case. I know that the C++ project can be converted into a DLL library, and its functions can be called in C# using `PInvoke`. [Link1](http://social.msdn.microsoft.com/Forums/vstudio/en-US/8151b379-da96-4b43-a179-07a3bbbb86fa/calling-c-dll-from-c), [Link2](http://stackoverflow.com/questions/569603/using-c-class-dll-in-c-sharp-application). Even if you call up it in C#, I do not know how you can to rotate is a `Window` (`Control`?) into WPF. – Anatoliy Nikolaev Aug 16 '13 at 11:23