C# WinForm 中鼠标在PictureBox中触发事件会调用构造函数吗?

代码为一个用户定义类Drawing当中的构造方法,我从代码:

PictureBox.MouseWheel += PictureBox_MouseWheel;

标记处开始不明白,构造方法不是在创建实例时调用且仅调用一次的吗?那么从

PictureBox.MouseWheel += PictureBox_MouseWheel;

哪有什么作用呢,鼠标在PictureBox上触发的事件还会再一次调用构造方法吗?
编程小白在线等

public Drawing(PictureBox pictureBox)

    {
        PictureBox = pictureBox;
        Points = new List<PointF>();
        PaintPoints = new List<PointF>();
        PictureBox.MouseWheel += PictureBox_MouseWheel;
        PictureBox.MouseDown += PictureBox_MouseDown;
        PictureBox.MouseUp += PictureBox_MouseUp;
        PictureBox.MouseMove += PictureBox_MouseMove;
        PictureBox.MouseEnter+=PictureBox_MouseEnter;
        PictureBox.Paint += PictureBox_Paint;

    }

查看全部
Ldtyt
Ldtyt
2020/02/15 11:21
  • c#
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复