/// <devdoc> ApplySettings - applies settings from the stub into a full-fledged /// TableLayoutSettings. /// /// NOTE: this is a one-time only operation - there is data loss to the stub /// as a result of calling this function. we hand as much over to the other guy /// so we dont have to reallocate anything /// </devdoc> internal void ApplySettings(TableLayoutSettings settings) { // // apply row,column,rowspan,colspan // TableLayout.ContainerInfo containerInfo = TableLayout.GetContainerInfo(settings.Owner); Control appliedControl = containerInfo.Container as Control; if (appliedControl != null && controlsInfo != null) { // we store the control names, look up the controls // in the appliedControl's control collection and apply the row,column settings. foreach (object controlName in controlsInfo.Keys) { ControlInformation controlInfo = controlsInfo[controlName]; // Look for the control in our table, we have to go through // PropertyDescriptor rather than just going using appliedControl.Controls[controlName] // because the Name property is shadowed at design time foreach (Control tableControl in appliedControl.Controls) { if (tableControl != null) { string name = null; PropertyDescriptor prop = TypeDescriptor.GetProperties(tableControl)["Name"]; if (prop != null && prop.PropertyType == typeof(string)) { name = prop.GetValue(tableControl) as string; } else { Debug.Fail("Name property missing on control"); } if (WindowsFormsUtils.SafeCompareStrings(name, controlName as string, /* ignoreCase = */ false)) { settings.SetRow(tableControl, controlInfo.Row); settings.SetColumn(tableControl, controlInfo.Column); settings.SetRowSpan(tableControl, controlInfo.RowSpan); settings.SetColumnSpan(tableControl, controlInfo.ColumnSpan); break; } } } } } // // assign over the row and column styles // containerInfo.RowStyles = rowStyles; containerInfo.ColumnStyles = columnStyles; // since we've given over the styles to the other guy, null out. columnStyles = null; rowStyles = null; // set a flag for assertion detection. isValid = false; }
internal void ApplySettings(TableLayoutSettings settings) { TableLayout.ContainerInfo containerInfo = TableLayout.GetContainerInfo(settings.Owner); Control container = containerInfo.Container as Control; if ((container != null) && (this.controlsInfo != null)) { foreach (object obj2 in this.controlsInfo.Keys) { TableLayoutSettings.ControlInformation information = this.controlsInfo[obj2]; foreach (Control control2 in container.Controls) { if (control2 != null) { string str = null; PropertyDescriptor descriptor = TypeDescriptor.GetProperties(control2)["Name"]; if ((descriptor != null) && (descriptor.PropertyType == typeof(string))) { str = descriptor.GetValue(control2) as string; } if (WindowsFormsUtils.SafeCompareStrings(str, obj2 as string, false)) { settings.SetRow(control2, information.Row); settings.SetColumn(control2, information.Column); settings.SetRowSpan(control2, information.RowSpan); settings.SetColumnSpan(control2, information.ColumnSpan); break; } } } } } containerInfo.RowStyles = this.rowStyles; containerInfo.ColumnStyles = this.columnStyles; this.columnStyles = null; this.rowStyles = null; this.isValid = false; }
//set the row position of the control public void SetRow(Control control, int row) { _tableLayoutSettings.SetRow(control, row); Debug.Assert(GetRow(control) == row, "GetRow should be the same as we set it"); }
public void SetRow(Control control, int row) { settings.SetRow(control, row); }
/// <devdoc> ApplySettings - applies settings from the stub into a full-fledged /// TableLayoutSettings. /// /// NOTE: this is a one-time only operation - there is data loss to the stub /// as a result of calling this function. we hand as much over to the other guy /// so we dont have to reallocate anything /// </devdoc> internal void ApplySettings(TableLayoutSettings settings) { // // apply row,column,rowspan,colspan // TableLayout.ContainerInfo containerInfo = TableLayout.GetContainerInfo(settings.Owner); Control appliedControl = containerInfo.Container as Control; if (appliedControl != null && controlsInfo != null) { // we store the control names, look up the controls // in the appliedControl's control collection and apply the row,column settings. foreach (object controlName in controlsInfo.Keys){ ControlInformation controlInfo = controlsInfo[controlName]; // Look for the control in our table, we have to go through // PropertyDescriptor rather than just going using appliedControl.Controls[controlName] // because the Name property is shadowed at design time foreach (Control tableControl in appliedControl.Controls) { if (tableControl != null) { string name = null; PropertyDescriptor prop = TypeDescriptor.GetProperties(tableControl)["Name"]; if (prop != null && prop.PropertyType == typeof(string)) { name = prop.GetValue(tableControl) as string; } else { Debug.Fail("Name property missing on control"); } if (WindowsFormsUtils.SafeCompareStrings(name, controlName as string, /* ignoreCase = */ false)) { settings.SetRow(tableControl, controlInfo.Row); settings.SetColumn(tableControl, controlInfo.Column); settings.SetRowSpan(tableControl, controlInfo.RowSpan); settings.SetColumnSpan(tableControl, controlInfo.ColumnSpan); break; } } } } } // // assign over the row and column styles // containerInfo.RowStyles = rowStyles; containerInfo.ColumnStyles = columnStyles; // since we've given over the styles to the other guy, null out. columnStyles = null; rowStyles = null; // set a flag for assertion detection. isValid = false; }
private void ParseControls(TableLayoutSettings settings, XmlNodeList controlXmlFragments) { foreach (XmlNode node in controlXmlFragments) { string attributeValue = this.GetAttributeValue(node, "Name"); if (!string.IsNullOrEmpty(attributeValue)) { int row = this.GetAttributeValue(node, "Row", -1); int num2 = this.GetAttributeValue(node, "RowSpan", 1); int column = this.GetAttributeValue(node, "Column", -1); int num4 = this.GetAttributeValue(node, "ColumnSpan", 1); settings.SetRow(attributeValue, row); settings.SetColumn(attributeValue, column); settings.SetRowSpan(attributeValue, num2); settings.SetColumnSpan(attributeValue, num4); } } }