Exemplo n.º 1
0
        /// <summary>
        /// Starts rendering a new frame with the black style. This gives the renderer a chance to cash some resources.
        /// </summary>
        public override void BeginFrame(BeginFrameRendererEventArgs args)
        {
            _CenteredTextStringFormat = new StringFormat();
            _CenteredTextStringFormat.Alignment = StringAlignment.Center;
            _CenteredTextStringFormat.LineAlignment = StringAlignment.Center;

            _TopCenteredTextStringFormat = new StringFormat();
            _TopCenteredTextStringFormat.Alignment = StringAlignment.Center;
            _TopCenteredTextStringFormat.LineAlignment = StringAlignment.Near;

            // With this fx and fy we convert between logical units and pixels.
            _ScaleFactorX = (float)args.Bounds.Width / args.Layout.LogicalWidth;
            _ScaleFactorY = (float)args.Bounds.Height / args.Layout.LogicalHeight;

            _KeysBounds = args.Bounds;

            float min = Math.Min(_ScaleFactorX, _ScaleFactorY);

            float keyFontSize = min * LinearKeyboardLayout.NormalKeySize / _KeyFontSizeRatio;
            float hintFontSize = min * LinearKeyboardLayout.NormalKeySize / _HintFontSizeRatio;

            if (keyFontSize < 1)
                keyFontSize = 1;
            if (hintFontSize < 1)
                hintFontSize = 1;

            _KeyFont = new Font(args.Font.FontFamily, keyFontSize);
            _HintFont = new Font(args.Font.FontFamily, hintFontSize);

            if (ForceAntiAlias)
                args.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Called when the control starts rendering a new frame.
 /// </summary>
 /// <param name="args">Provides context information.</param>
 public virtual void BeginFrame(BeginFrameRendererEventArgs args) { }