Ejemplo n.º 1
0
        private void OnPaintSurface(object sender, SKPaintSurfaceEventArgs e)
        {
            e.Surface.Canvas.DrawRect(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width,
                                      ClientRectangle.Height, new SKPaint()
            {
                Color = BackColor.SKColor(), Style = SKPaintStyle.Fill
            });

            var paint = Font.SKPaint();

            paint.Color = ForeColor.SKColor();

            if (noofchars <= label.Length && resize)
            {
                noofchars = label.Length;
                float textSize = paint.MeasureText(label);
                this.Width = (int)textSize;
            }

            e.Surface.Canvas.DrawText(label, 0, Height - 2, paint);
        }