static void FixControl(Control control, NonGapKeyLayout layout) { if (layout.FontSize != 0) { control.FontSize = layout.FontSize; } }
TControl CreateControl <TControl>(NonGapKeyLayout layout, double left, double top, double width, double height, bool isVisible) where TControl : Control, IHostedControl, new() { var control = new TControl { Keytop = layout.Caption, Height = layout.KeyHeight * height, Width = width, Visibility = isVisible ? Visibility.Visible : Visibility.Hidden }; if (layout.Style != null) { var style = GetStyle(layout); control.Button.Style = style; } if (layout.FontSize != 0) { control.FontSize = _fontSizeMultiplier * layout.FontSize; } control.KeyboardHost = _host; control.SetMultiplier(layout.Multiplier, layout.RepeatMultiplier); Canvas.SetLeft(control, left); Canvas.SetTop(control, top); _canvas.Children.Add(control); return(control); }