标题:为什么编译能通过,运行时却没效果。
只看楼主
chenweijun
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2011-4-25
 问题点数:0 回复次数:0 
为什么编译能通过,运行时却没效果。
class apple
    {
        public int x;
        public int y;
        public Bitmap tupian=null;

        public  apple()        
        {
        tupian = new Bitmap(500,500);

         }
        public Bitmap  move()
        {
            Graphics g = Graphics.FromImage(tupian);
            Pen p = new Pen(Color.Red);
            g.Clear(Color.Yellow);
            g.DrawEllipse(p, x, y, 50, 100);
           
            x = x + 5;
            y = y + 5;
            return tupian;


        }


         

    }
    //以下是window窗口下的form1.
    public partial class Form1 : Form
    {
        apple abc = new apple() ;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            timer1.Enabled = true;
        }


        private void timer1_Tick(object sender, EventArgs e)
        {
            pictureBox1.Image = abc.move();

        }

      
      


      
    }

搜索更多相关主题的帖子: tupian return apple null 
2011-04-26 20:20



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-337996-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.894319 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved