using System; using CPF.Drawing; using CPF.ReoGrid.Graphics; namespace CPF.ReoGrid.Drawing { public class DrawingObjectStyle : IDrawingObjectStyle { public DrawingObject OwnerObject { get; private set; } internal DrawingObjectStyle(DrawingObject owner) { this.OwnerObject = owner; } protected void ValidateReferenceOwner() { bool flag = this.OwnerObject == null; if (flag) { throw new ReferenceObjectNotAssociatedException("Drawing object style has not valid owner."); } } public Color FillColor { get { this.ValidateReferenceOwner(); return this.OwnerObject.FillColor; } set { this.ValidateReferenceOwner(); this.OwnerObject.FillColor = value; this.OwnerObject.Invalidate(); } } public Color LineColor { get { this.ValidateReferenceOwner(); return this.OwnerObject.LineColor; } set { this.ValidateReferenceOwner(); this.OwnerObject.LineColor = value; this.OwnerObject.Invalidate(); } } public float LineWidth { get { this.ValidateReferenceOwner(); return this.OwnerObject.LineWidth; } set { this.ValidateReferenceOwner(); this.OwnerObject.LineWidth = value; this.OwnerObject.Invalidate(); } } public LineStyles LineStyle { get { this.ValidateReferenceOwner(); return this.OwnerObject.LineStyle; } set { this.ValidateReferenceOwner(); this.OwnerObject.LineStyle = value; this.OwnerObject.Invalidate(); } } } }