New to Telerik UI for WinFormsStart a free 30-day trial

How to create QWERTZ keyboard

Updated over 6 months ago

Environment

Product VersionProductAuthor
2021.1.223RadVirtualKeyboard for WinFormsNadya Karaivanova

Description

By default, RadVirtualKeybord is of QWERTY keyboard type. However, it is a commom requirement to customize the keyboard to another type, for example - QWERTZ or AZERTY. The main difference between these three keyboards is the position of the Q, W, Z and A keys.

This tutorial will demonstrate how you can achieve this type of keyboard with RadVirtualKeyboard control.

create-qwertz-keyboard001

Solution

In order to achieve this, we need to replace the positions of the Y and Z keys. We should find the desired keys, remove them from the Keys collection, then insert the keys back on desired position. The following code snippet demonstrates this:

C#
public RadForm1()
{
    InitializeComponent();

    this.radVirtualKeyboard1.LayoutType = KeyboardLayoutType.Simplified;
    SimplifiedVirtualKeyboardLayoutPanel simplifiedLayoutPanel = this.radVirtualKeyboard1.MainLayoutPanel as SimplifiedVirtualKeyboardLayoutPanel;
    VirtualKeyboardLayout mainLayout = simplifiedLayoutPanel.MainButtonsLayout;
    Key Zkey = mainLayout.Rows[3].Keys.FirstOrDefault(k => k.VirtualKey == (int)Keys.Z) as Key;
    int zKeyIndex = mainLayout.Rows[3].Keys.IndexOf(Zkey);
    Key Ykey = mainLayout.Rows[1].Keys.FirstOrDefault(k => k.VirtualKey == (int)Keys.Y) as Key;
    int yKeyIndex = mainLayout.Rows[1].Keys.IndexOf(Ykey);
    //Remove keys
    mainLayout.Rows[3].Keys.Remove(Zkey);
    mainLayout.Rows[1].Keys.Remove(Ykey);
    //Insert keys
    mainLayout.Rows[1].Keys.Insert(yKeyIndex, Zkey);
    mainLayout.Rows[3].Keys.Insert(zKeyIndex, Ykey);
    //Reset layout
    mainLayout.ResetLayout(true);
}

Feel free to use this approach in order to customize the position of the keys in any way that is suitable for you.

In this article
EnvironmentDescriptionSolution
Not finding the help you need?
Contact Support