예제 #1
0
파일: Form1.cs 프로젝트: niccokunzmann/ping
        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            // http://codesmesh.com/c-drawing-circlelinerectangle-and-ellipse-on-forms/
            Graphics g = e.Graphics;

            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            if (connected)
            {
                g.Clear(Color.Green);
            }
            else
            {
                g.Clear(Color.Red);
            }
            Pen pen = new Pen(Color.Black);

            foreach (Ball ball in balls)
            {
                ball.Draw(g);
            }

            foreach (Block block in blocks)
            {
                block.Draw(g);
            }
            pen.Dispose();
        }