internal TableLayoutSettings (TableLayoutPanel panel) { this.column_styles = new TableLayoutColumnStyleCollection (panel); this.row_styles = new TableLayoutRowStyleCollection (panel); this.grow_style = TableLayoutPanelGrowStyle.AddRows; this.column_count = 0; this.row_count = 0; this.columns = new Dictionary<object, int> (); this.column_spans = new Dictionary<object, int> (); this.rows = new Dictionary<object, int> (); this.row_spans = new Dictionary<object, int> (); this.panel = panel; }
public Main() { InitializeComponent(); // Load options from Options.FILENAME file // If the file doesn't exist, or broken, options will be Default options = Options.getOption(); // Initialize some other controls might depends on options InitializeOtherControls(); InitDrawingComponent(); InitEventAnnoComponent(); //Load images to imageList //loadImages(); //comboBox1.SelectedIndex = 0; //Just for sample GUI test setMinimumFrameTrackBar(0); setMaximumFrameTrackBar(100); previousSize = this.Size; rowStyles = annotateTableLayoutPanel.RowStyles; columnStyles = annotateTableLayoutPanel.ColumnStyles; originalRowStyles = new RowStyle[rowStyles.Count]; originalColumnStyles = new ColumnStyle[columnStyles.Count]; for (int i = 0; i < rowStyles.Count; i++) { originalRowStyles[i] = new RowStyle(rowStyles[i].SizeType, rowStyles[i].Height); } for (int i = 0; i < columnStyles.Count; i++) { originalColumnStyles[i] = new ColumnStyle(columnStyles[i].SizeType, columnStyles[i].Width); } for (int i = 0; i < rowStyles.Count; i++) { Console.WriteLine("Row " + i + " " + annotateTableLayoutPanel.GetRowHeights()[i]); } for (int i = 0; i < columnStyles.Count; i++) { Console.WriteLine("Column " + i + " " + annotateTableLayoutPanel.GetColumnWidths()[i]); } Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US"); }
private TableLayoutSettings (SerializationInfo serializationInfo, StreamingContext context) { TypeConverter converter = TypeDescriptor.GetConverter (this); string text = serializationInfo.GetString ("SerializedString"); if (!string.IsNullOrEmpty (text) && (converter != null)) { TableLayoutSettings settings = converter.ConvertFromInvariantString (text) as TableLayoutSettings; this.column_styles = settings.column_styles; this.row_styles = settings.row_styles; this.grow_style = settings.grow_style; this.column_count = settings.column_count; this.row_count = settings.row_count; this.columns = settings.columns; this.column_spans = settings.column_spans; this.rows = settings.rows; this.row_spans = settings.row_spans; this.panel = settings.panel; this.isSerialized = true; } }
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; }
private void tableLayoutPanel_MouseDown(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { columnStyles = tableLayoutPanel.ColumnStyles; resizing = true; } }
/// <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; }
static void Assert_AreEqual(TableLayoutColumnStyleCollection expected, TableLayoutColumnStyleCollection actual, String message) { for (int i = 0; i < Math.Min(expected.Count, actual.Count); ++i) { ColumnStyle expectedCur = expected[i]; ColumnStyle actualCur = actual[i]; Assert_AreEqual(expectedCur, actualCur, "TableLayoutColumnStyleCollection[" + i + "] -- " + message); } // Check this *after*, so that if the initial values in the lists don't match // that's reported instead -- it makes it more obvious what is being mis-parsed. Assert.AreEqual(expected.Count, actual.Count, "TableLayoutColumnStyleCollection.Count -- " + message); }
public ContainerInfo(ContainerInfo containerInfo) { _cellBorderWidth = containerInfo.CellBorderWidth; _maxRows = containerInfo.MaxRows; _maxColumns = containerInfo.MaxColumns; _growStyle = containerInfo.GrowStyle; _container = containerInfo.Container; _rowStyles = containerInfo.RowStyles; _colStyles = containerInfo.ColumnStyles; }