开发者

e.Graphics.Draw

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜