TX Text Control Blog

Insert special characters using the modifier keys

Blogged by Björn Meyer on October 30, 2008 and tagged with sample.

The modifier key AltGr is commonly used to insert special characters or currency symbols. In some languages, it is used to insert accented characters.

By default, TX Text Control implements the functionality of the CTRL modifier on the AltGr key as well. To implement the language specific functionality, you need to cancel the TX Text Control handling by trapping the keystrokes.

As an example, the following code shows how to implement the Polish special characters ż and ź that are inserted when pressing AltGr+Z and AltGr+X:

private void textControl1_KeyDown(object sender, KeyEventArgs e) { if (e.Modifiers == (Keys.Alt | Keys.Control)) { switch(e.KeyCode) { case Keys.Z: textControl1.Selection.Text = "ż"; break; case Keys.X: textControl1.Selection.Text = "ź"; break; } e.Handled = true; } }

More about the different implementations of the AltGr key can be found here:

Wikipedia: AltGr key

 
 
 

Products

Support

Downloads

Corporate

Buy Now