Beispiel #1
0
        private void MainForm_Paint(object sender, PaintEventArgs e)
        {
            Graphics     gr         = e.Graphics;
            GraphicsPath gp         = new GraphicsPath();
            int          baseRadius = ClientSize.Width > ClientSize.Height ? ClientSize.Height / 2 : ClientSize.Width / 2;

            gp.AddBezier(
                new Point(ClientSize.Width / 2, ClientSize.Height / 4),
                new Point(ClientSize.Width / 3, 0),
                new Point(0, ClientSize.Height * 2 / 4),
                new Point(ClientSize.Width / 2, ClientSize.Height)
                );
            gp.AddBezier(
                new Point(ClientSize.Width / 2, ClientSize.Height),
                new Point(ClientSize.Width, ClientSize.Height * 2 / 4),
                new Point(ClientSize.Width - ClientSize.Width / 3, 0),
                new Point(ClientSize.Width / 2, ClientSize.Height / 4)
                );

            PathGradientBrush br = new PathGradientBrush(gp)
            {
                CenterPoint    = new PointF(ClientSize.Width / 2, ClientSize.Height * 5 / 9),
                CenterColor    = Color.White,
                SurroundColors = new Color[] { Color.MediumVioletRed }
            };

            gr.FillPath(br, gp);

            DrawArrow(Color.Yellow, 2, gr, baseRadius * 2 / 5, TimeReceiver.GetTime().Second * 6); //Get time from the server
            DrawArrow(Color.DarkBlue, 5, gr, baseRadius / 3, TimeReceiver.GetTime().Minute * 6);   //Get time from the server
            DrawArrow(Color.DeepPink, 8, gr, baseRadius / 4, TimeReceiver.GetTime().Hour * 30);    //Get time from the server
            DrawScale(Color.Black, 1, gr, baseRadius, -30);
        }
Beispiel #2
0
 private void Timer1_Tick(object sender, EventArgs e)
 {
     Invalidate();
     label1.Text = TimeReceiver.GetTime().ToString("T");  //Get time from the server
 }