public void RefreshBaseItems(iStruct istruct, int change) { int c = pnlValues.Controls.Count - 1; bool now = false; //Loop for every control for (int i = 0; i < c + 1; i++) { if (pnlValues.Controls[c - i] == istruct) { now = true; } else { if (now) { pnlValues.Controls[c - i].Location = new Point(0, pnlValues.Controls[c - i].Location.Y + change); } } } }
public void ResizeParentsRecursively() { iStruct lastStruct = this; //Set the first control Control parent = this; //Get our height change int heightChange = Height - previous_height; //Continue to loop while (true) { //Set the parent, this will keep setting and looping parent = parent.Parent; //...Until the parent is null if (Parent == null) { //...Then it'll exit the loop break; } //...Or until we hit the meta editor container if (parent.Name == "MetaEditorContainer") { //Then resize base children and break ((MetaEditorContainer)parent).RefreshBaseItems(lastStruct, heightChange); //Break break; } //But if its a structure as a parent if (parent.Name == "iStruct") { //Size it to match its values. ((iStruct)parent).ResizeHeight(); ((iStruct)parent).RefreshBaseItems(lastStruct, heightChange); lastStruct = ((iStruct)parent); } } }