private void diagramControl1_OnEntityAdded(object sender, EntityEventArgs e) { string msg = string.Empty; if (e.Entity is IShape) { msg = "New shape '" + e.Entity.EntityName + "' added."; } else if (e.Entity is IConnection) { msg = "New connection added."; } if (msg.Length > 0) { Application.Status.ShowStatusText(msg); } if (e.Entity is ComplexRectangle) { ComplexRectangle shape = e.Entity as ComplexRectangle; try { //shape.Services[typeof(IMouseListener)]= new MyPlugin(shape); } catch (ArgumentException exc) { Application.Status.ShowStatusText(exc.Message); } } else if (e.Entity is ImageShape) { Bitmap bmp = GetSampleImage(); if (bmp != null) { (e.Entity as ImageShape).Image = bmp; } } }
public MyPlugin(ComplexRectangle shape) { this.shape = shape; }