I have discovered how to paint but do not understand that Gra开发者_开发技巧phics is property of class PaintEventArgs..how can property have a method? I thought property can have just set and get blocks.
If the property is an instance of a class, then it is the class that has the method. Not the property itself.
public class A
{
public B MyProperty { get; set; }
}
public class B
{
public void DoSomething()
{
}
}
So something like new A().MyProperty.Dosomething();
is valid.
A property can get or set an object. That object can have methods.
The Graphics object is being provided to you in the PaintEventArgs, so you CAN draw.
精彩评论