标题:c#参数 这里是怎么传递的?
取消只看楼主
aamen110
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-8-14
结帖率:50%
已结贴  问题点数:10 回复次数:0 
c#参数 这里是怎么传递的?
public partial class Form1 : Form
    {
      
        public Form1()
        {
            InitializeComponent();
        }

      

        private void button3_Click(object sender, EventArgs e)
        {
            shape line = new line(10, 10, 100, 100);
            line.draw(this.panel1.CreateGraphics());
           
        }

        private void button1_Click(object sender, EventArgs e)
        {
            shape ep = new eillpse(20, 20, 200, 200);
            ep.draw(this.panel1.CreateGraphics());
        }

        private void button2_Click(object sender, EventArgs e)
        {
            shape re = new eillpse(20, 20, 200, 200);
            re.draw(this.panel1.CreateGraphics());
        }
    }

   public  class line :shape
   {
       public line(int x1, int y1, int x2, int y2)
           : base(x1, y1, x2, y2)
       { }
       public override void draw(Graphics g)
       {
         
          Pen mypen =new Pen (Color .Red )   ;
          g.DrawLine(mypen , this.X1  , this.Y1, this.X2, this.Y2);
       }
        
    }
 public class eillpse : shape
    {
        public eillpse(int x1, int y1, int x2, int y2)
            : base(x1, y1, x2, y2)
        { }
        public override void draw(Graphics g)
        {

            Pen mypen = new Pen(Color.Red);
            g.DrawEllipse(mypen, this.X1, this.Y1, this.X2, this.Y2);
        }

    }
 public class regricle : shape
    {
        public regricle(int x1, int y1, int x2, int y2)
            : base(x1, y1, x2, y2)
        { }
        public override void draw(Graphics g)
        {

            Pen mypen = new Pen(Color.Red);
            g.DrawRectangle(mypen, this.X1, this.Y1, this.X2, this.Y2);
        }

    }
搜索更多相关主题的帖子: private public class 
2011-10-21 23:14



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




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

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