protected BaseComponent(ComponentResource resource, string name, Size size) { _resource = resource; Name = name; Size = size; Position = new Point(0, 0); Rotation = ComponentRotation.Normal; }
//============================================================ // <T>将来源组件插入到目标组件之后。</T> // // @param sourceComponent 组件 // @param targetComponent 组件 //============================================================ public virtual void InsertAfter(FUiComponent sourceComponent, FUiComponent targetComponent) { if (sourceComponent != null) { sourceComponent.Parent = this; } Components.InsertAfter(sourceComponent, targetComponent); ComponentResource.InsertAfter(sourceComponent.ComponentResource, targetComponent.ComponentResource); }
//============================================================ // <T>在父对象中删除自己。</T> //============================================================ public void RemoveFromParent() { // 资源删除 ComponentResource.RemoveFromParent(); // 控件删除 FUiComponent parent = _parent as FUiComponent; if (parent != null) { parent.Remove(this); } }
public CircuitComponent(ComponentResource resource, string name) : base(resource, name, new Size(resource.Width, resource.Height)) { }