求助: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
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
评论

打赏作者

ggting0000

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值