求助:C#编程中遇到的问题

自己写了一段代码(windows窗体应用程序),主要用于实现风车的转动,但出现了一点问题,求助。。

***********************************

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Timers;
using System.Threading;
using System.Windows.Forms;
using System.Drawing.Drawing2D;

namespace 大风车
{
    public partial class Form1 : Form
    {
        public int i = 0;
        public Form1()
        {
            InitializeComponent();
        }

        private void button3_Click(object sender, EventArgs e)  //退出
        {
            Application.Exit();
            //this.Close(); 
           /* if (MessageBox.Show("Do you want to exit?", "My Application",
                  MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                  == DialogResult.Yes)
            {
                Application.Exit();
            }*/
        }

       private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (MessageBox.Show("你真的要退出应用程序吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                 MessageBoxDefaultButton.Button3) == DialogResult.No)

           e.Cancel = true;
       
        }
      
        private void Form1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)  //开始
        {
            this.timer1.Start();
            this.timer1_Tick(sender, null);

            this.axWindowsMediaPlayer1.URL = "E://音乐//大风车.mp3";
            this.axWindowsMediaPlayer1.Ctlcontrols.play();
            this.pictureBox1.Refresh();     
        }

        public void ExitApplication()
        {
    
        }


        private void button2_Click(object sender, EventArgs e)   //暂停
        {
            this.timer1.Stop();
            this.axWindowsMediaPlayer1.Ctlcontrols.pause();
        }

        public void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            
            e.Graphics.Clear(Color.Black);

            SolidBrush mybrush = new SolidBrush(Color.Blue);

           e.Graphics.FillPie(mybrush,Convert.ToInt32(220 - Math.Sin(6 * i) * 60), Convert.ToInt32(130 - Math.Cos(i * 6) * 60), 40, 60, -90 - i * 20, 180);
             // e.Graphics.FillPie(mybrush, Convert.ToInt32(188 - Math.Sin(20 * i) * 60), Convert.ToInt32(86 - Math.Cos(i * 20) * 60), 40, 60, -90 -20, 180);

              mybrush.Color = Color.Red;
              e.Graphics.FillPie(mybrush, Convert.ToInt32(240 - Math.Cos(6 * i) * 60), Convert.ToInt32(110 +  Math.Sin(i * 6) * 60), 60, 40, -180 - i * 20, 180);
              mybrush.Color = Color.Green;
              e.Graphics.FillPie(mybrush, Convert.ToInt32(160 + Math.Cos(6 * i) * 60), Convert.ToInt32(130- Math.Sin(i * 6) * 60), 40, 60, -270 - i * 20, 180 );
              mybrush.Color = Color.Yellow;
              e.Graphics.FillPie(mybrush, Convert.ToInt32(240 + Math.Sin(6 * i) * 60), Convert.ToInt32(50 + Math.Cos(i * 6) * 60), 60, 40, -360 - i * 20, 180 );
      
           
        }

        private void timer1_Tick(object sender, EventArgs e)
        {

            this.pictureBox1.Refresh();
            i++;
        }

        private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e)
        {

        }
        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            this.timer1.Interval = this.trackBar1.Value;
        }

 

     
    }
}
****************************************

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值