public FormGenericTable(string strCaption, string [] astrHead, float [] afLines, FormGenericTableLayout.eFormGenericTableToken eToken) { TextBox tb; int ntbHeigth; bSelfMoving = true; nCntHiddenCols = 0; InitializeComponent(); Text = strCaption; AttachTemplate(eToken); nYOffsetDataGrid = toolStripMain.Location.Y + toolStripMain.Size.Height; if (astrHead != null) { for (int i = 0; i < astrHead.GetLength(0); i++) { tb = new TextBox(); tb.Text = astrHead[i]; tb.ReadOnly = true; tb.Multiline = true; tb.ScrollBars = ScrollBars.Vertical; ntbHeigth = (int)(tb.Font.Height * afLines[i]); tb.Location = new Point(0, nYOffsetDataGrid); tb.Size = new Size(ClientSize.Width, ntbHeigth); nYOffsetDataGrid += tb.Size.Height; Controls.Add(tb); } } bSelfMoving = false; }
private void AttachTemplate(FormGenericTableLayout.eFormGenericTableToken eToken) { this.formTemplate = null; foreach (FormGenericTableLayout formTemplate in listFormTemplate) { if (formTemplate.IsType(eToken)) { this.formTemplate = formTemplate; break; } } if (this.formTemplate != null) { Location = this.formTemplate.Location; Size = this.formTemplate.Size; } else { this.formTemplate = new FormGenericTableLayout(eToken); listFormTemplate.Add(this.formTemplate); } }