ویژوال 30 شارپ

سورس کدهای جالب سی شارپ فقط با یک نگاه

ویژوال 30 شارپ

سورس کدهای جالب سی شارپ فقط با یک نگاه

Radar

using System.Drawing.Drawing2D;

int i = 0;
        private void timer1_Tick(object sender, EventArgs e)
        {
            i += 2;
            Rectangle r = new Rectangle(0, 0, pictureBox1.Width - 1, pictureBox1.Height - 1);
            Bitmap b = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            Graphics g = Graphics.FromImage(b);
            g.SmoothingMode = SmoothingMode.AntiAlias;
            SolidBrush sb = new SolidBrush(Color.Blue);
            for (int k = 1; k < 180; k++)
            {
                sb.Color = Color.FromArgb((255 * k) / 180, 0, (255 * k) / 180, (255 * k) / 180);
                g.FillPie(sb, r, i + k, 1);
            }
            sb.Color = Color.FromArgb(0, 150, 150);
            g.FillEllipse(sb, new Rectangle(r.Width / 2 - 4, r.Height / 2 - 4, 8, 8));
            g.DrawEllipse(new Pen(Brushes.Blue), r);
            g.DrawEllipse(new Pen(sb), r);
            pictureBox1.Image = b;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.FormBorderStyle = FormBorderStyle.None;
            timer1.Interval = 1;
            this.Size = new Size(125, 125);
            pictureBox1.Size = new Size(125, 125);
            pictureBox1.BackColor = Color.FromArgb(64, 64, 64);
            this.TransparencyKey = pictureBox1.BackColor;
            Rectangle r = new Rectangle(0, 0, pictureBox1.Width - 1, pictureBox1.Height - 1);
            SolidBrush lb = new SolidBrush(Color.Black);
            Bitmap b = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            Graphics g = Graphics.FromImage(b);
            g.SmoothingMode = SmoothingMode.AntiAlias;
            g.FillEllipse(lb, r);
            pictureBox1.BackgroundImage = b;
        }

نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد