private void Form1_Paint(object sender,
System.Windows.Forms.PaintEventArgs pe)
{
// Declares the Graphics object and sets it to the Graphics object
// supplied in the PaintEventArgs.
Graphics g = pe.Graphics;
// Insert code to paint the form here.
}
我有一些问题:
我们能否更改
Form1_Paint
方法的名称?我的意思是它是否必须具有"Paint"后缀?.net何时调用此方法?框架如何知道调用哪个方法以便绘制图像?我不明白为什么我们只定义了
Form1_Paint
方法可以接收两个参数,然后框架会自动调用该方法,并传递一个对object
和PaintEventArgs
对象(pe)的引用。
非常抱歉问这样蠢的问题,但我的编程主要是函数式的,并且我对使用框架感到困惑,因为它们似乎在调用自己的方法。 有人能以6岁孩子的方式解释一下吗?