Class Key
The key class represents a single button on a physical keyboard. Letters, numbers, functions, and symbols are all represented on keys.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.VirtualKeyboard
Assembly: Telerik.WinControls.UI.dll
Syntax
public class Key : LightVisualRepeatButtonElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IComponent, IDisposable, IBindableComponent, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IImageElement, ITextPrimitive, ITextProvider, IKey
Constructors
Key()
This method is used internally. To create a new Key instance use the other constructors instead.
Declaration
public Key()
Key(Int32, String, KeyType, Double, Double, Boolean, Boolean, Font)
Initializes a new instance of the Key class.
Declaration
public Key(int keyCode, string displayText, KeyType keyType, double width, double height, bool sharpStyle = false, bool showSecondaryText = false, Font font = null)
Parameters
System.Int32
keyCode
The virtual key code. |
System.String
displayText
The display text. |
KeyType
keyType
The type of the key. |
System.Double
width
The logical key width. |
System.Double
height
The logical key height. |
System.Boolean
sharpStyle
Indicates whether the key has more noticeable(sharp) style. |
System.Boolean
showSecondaryText
Indicates whether to show the secondary text element. |
System.Drawing.Font
font
The font specified to the key element. |
Key(Int32, KeyType, Double, Double, Boolean, Boolean)
Initializes a new instance of the Key class.
Declaration
public Key(int keyCode, KeyType keyType, double width, double height, bool sharpStyle = false, bool showSecondaryText = false)
Parameters
System.Int32
keyCode
The virtual key code. |
KeyType
keyType
The type of the key. |
System.Double
width
The logical key width. |
System.Double
height
The logical key height. |
System.Boolean
sharpStyle
Indicates whether the key has more noticeable(sharp) style. |
System.Boolean
showSecondaryText
Indicates whether to show the secondary text element. |
Fields
IsSharpStyleProperty
Dependency property that indicates whether the key should have more noticeable/sharp style.
Declaration
public static RadProperty IsSharpStyleProperty
Field Value
RadProperty
|
SecondaryForeColorProperty
Dependency property that defines the fore color of secondary text element.
Declaration
public static RadProperty SecondaryForeColorProperty
Field Value
RadProperty
|
Properties
AccessibleName
Gets or sets the name of the control for use by accessibility client applications.
Declaration
public override string AccessibleName { get; set; }
Property Value
System.String
|
Overrides
DisplayText
Gets or sets the display text.
Declaration
public string DisplayText { get; set; }
Property Value
System.String
|
FontScale
Gets or sets the font scale coefficient, used when key is larger or smaller than the KeyDefaultSize.
Declaration
public float FontScale { get; set; }
Property Value
System.Single
|
Implements
ForeColor
Gets or sets the foreground color. Color type represents an ARGB color. Note that then shift key is active and secondary text is shown, the SecondaryForeColor value will be returned as ForeColor.
Declaration
public override Color ForeColor { get; set; }
Property Value
System.Drawing.Color
|
Overrides
IsSharpStyle
Gets or sets a value indicating whether the key will have more noticeable/sharp style.
Declaration
public bool IsSharpStyle { get; set; }
Property Value
System.Boolean
|
KeyHeight
Gets or sets the logical key height.
Declaration
public float KeyHeight { get; set; }
Property Value
System.Single
|
Implements
KeyInfo
Gets or sets the associated key info object.
Declaration
public KeyInfo KeyInfo { get; set; }
Property Value
KeyInfo
|
Implements
KeyRectangle
Gets or sets the logical key bounds.
Declaration
public RectangleF KeyRectangle { get; set; }
Property Value
System.Drawing.RectangleF
|
Implements
KeyType
Gets the type of the key.
Declaration
public KeyType KeyType { get; set; }
Property Value
KeyType
|
Implements
KeyWidth
Gets or sets the logical key width.
Declaration
public float KeyWidth { get; set; }
Property Value
System.Single
|
Implements
Owner
Gets the owner element used to send the keys.
Declaration
public IVirtualKeyboardKeyInputSender Owner { get; }
Property Value
IVirtualKeyboardKeyInputSender
|
Implements
SecondaryForeColor
Gets or sets the secondary text fore color.
Declaration
public Color SecondaryForeColor { get; set; }
Property Value
System.Drawing.Color
|
SecondaryTextElement
Gets the element that display the secondary text.
Declaration
public LightVisualElement SecondaryTextElement { get; }
Property Value
LightVisualElement
|
ShowSecondaryText
Gets or sets a value indicating whether to show the secondary text.
Declaration
public bool ShowSecondaryText { get; set; }
Property Value
System.Boolean
|
ThemeEffectiveType
Gets the type by which this instance is being themed.
Declaration
protected override Type ThemeEffectiveType { get; }
Property Value
System.Type
|
Overrides
VirtualKey
Gets the virtual key code.
Declaration
public int VirtualKey { get; set; }
Property Value
System.Int32
|
Implements
Methods
ArrangeKey(RectangleF)
Arranges the key in the specified rectangle.
Declaration
public void ArrangeKey(RectangleF rectangle)
Parameters
System.Drawing.RectangleF
rectangle
The layout rectangle. |
Implements
CreateChildElements()
Called by the element when constructed. Allows inheritors to build the element tree.
Declaration
protected override void CreateChildElements()
Overrides
CreateSecondaryTextElement()
Creates a SecondaryTextElement used as an element to display the secondary text.
Declaration
protected virtual SecondaryTextElement CreateSecondaryTextElement()
Returns
SecondaryTextElement
|
GetKeyScaleCoefficient(Single, Boolean)
Gets the font scale coefficient
Declaration
protected virtual float GetKeyScaleCoefficient(float scale, bool reduceDownscale = false)
Parameters
System.Single
scale
Base scale factor. |
System.Boolean
reduceDownscale
A boolean property that indicates whether to slow down the down scale process. |
Returns
System.Single
|
GetScaledFont(Single)
Scales the System.Drawing.Font used by the Paint process. The Font property is not changed.
Declaration
public override Font GetScaledFont(float scale)
Parameters
System.Single
scale
Scale factor. |
Returns
System.Drawing.Font
The scaled font. |
Overrides
InitializeFields()
Initializes member fields to their default values. This method is called prior the CreateChildItems one and allows for initialization of members on which child elements depend.
Declaration
protected override void InitializeFields()
Overrides
OnClick(EventArgs)
Raises the Click event.
Declaration
protected override void OnClick(EventArgs e)
Parameters
System.EventArgs
e
|
Overrides
OnLoaded()
Called when the element has been successfully loaded. That includes loading of all its children as well.
Declaration
protected override void OnLoaded()
Overrides
SendKey()
Sends a virtual key code or string.
Declaration
public virtual void SendKey()
Implements
UpdateKey()
Updates key text and other necessary styles.
Declaration
public virtual void UpdateKey()