Exemplo n.º 1
0
        void DrawMaterialTimePickerDate(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            canvas.FontColor = TextColor.ToGraphicsColor(Material.Color.Dark, Material.Color.Light);
            canvas.FontSize  = 16f;

            float margin = 12f;

            var horizontalAlignment = HorizontalAlignment.Left;

            var x = dirtyRect.X + margin;

            if (FlowDirection == FlowDirection.RightToLeft)
            {
                x = dirtyRect.X;
                horizontalAlignment = HorizontalAlignment.Right;
            }

            var height = dirtyRect.Height;
            var width  = dirtyRect.Width;

            var time = TimePickerDialog.GetTime(this);
            var date = new DateTime(time.Ticks);

            canvas.DrawString(date.ToString(Format), x, 22f, width - margin, height, horizontalAlignment, VerticalAlignment.Top);

            canvas.RestoreState();
        }
Exemplo n.º 2
0
        void DrawFluentTimePickerDate(ICanvas canvas, RectangleF dirtyRect)
        {
            var height  = FluentTimePickerHeight;
            var divided = FluentDatePickerWidth / 3;

            var time = TimePickerDialog.GetTime(this);
            var date = new DateTime(time.Ticks);

            Color textColor;

            if (IsEnabled)
            {
                textColor = ColorHelper.GetGraphicsColor(Fluent.Color.Foreground.Black, Fluent.Color.Foreground.White);
            }
            else
            {
                textColor = ColorHelper.GetGraphicsColor(Fluent.Color.Foreground.NeutralTertiary, Fluent.Color.Foreground.White);
            }

            float fontSize = 14f;

            canvas.SaveState();

            canvas.FontColor = textColor;
            canvas.FontSize  = fontSize;

            canvas.DrawString(date.ToString("HH"), 0, 0, divided, height, HorizontalAlignment.Center, VerticalAlignment.Center);

            canvas.RestoreState();

            canvas.SaveState();

            canvas.FontColor = textColor;
            canvas.FontSize  = fontSize;

            canvas.DrawString(date.ToString("mm"), divided, 0, divided, height, HorizontalAlignment.Center, VerticalAlignment.Center);

            canvas.RestoreState();

            canvas.SaveState();

            canvas.FontColor = textColor;
            canvas.FontSize  = fontSize;

            canvas.DrawString(date.ToString("tt"), divided * 2, 0, divided, height, HorizontalAlignment.Center, VerticalAlignment.Center);

            canvas.RestoreState();
        }
        void DrawCupertinoTimePickerDate(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            canvas.FontColor = ColorHelper.GetGraphicsColor(Material.Color.Black, Material.Color.White);
            canvas.FontSize  = 14f;

            float margin = 8f;

            var x = dirtyRect.X + margin;

            var height = dirtyRect.Height;
            var width  = dirtyRect.Width;

            var time = TimePickerDialog.GetTime(this);
            var date = new DateTime(time.Ticks);

            canvas.DrawString(date.ToString(Format), x, 0, width - margin, height, HorizontalAlignment.Left, VerticalAlignment.Center);

            canvas.RestoreState();
        }