开发者

e.Graphics.Draw

开发者 https://www.devze.com 2023-02-08 03:38 出处:网络
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 bloc

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

精彩评论

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

关注公众号