private void HandleShapeChanged(object sender, ShapeEventArgs e) { Shape s = (Shape)sender; Console.WriteLine($"收到消息,当前面积是:{e.NewArea}"); s.Draw(); }
protected virtual void OnShapeChanged(ShapeEventArgs e) { //EventHandler<ShapeEventArgs> handler = ShapeChanged; //if (handler != null) //{ // handler(this, e); //} ShapeChanged?.Invoke(this, e); }
protected override void OnShapeChanged(ShapeEventArgs e) { base.OnShapeChanged(e); }