public void InitializeVarLabels(ArrayList varList) { this.varLabels = new ProcessVarLabel[varList.Count]; this.SuspendLayout(); ProcessVarLabel varLabel; for (int i = 0; i < varLabels.Length; i++) { varLabel = new ProcessVarLabel(); varLabels[i] = varLabel; varLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; varLabel.Location = new System.Drawing.Point(0, i * 20); //varLabel.Name = "label" + ((ProcessVar)varList[i]).Name; varLabel.Size = new System.Drawing.Size(192, 20); varLabel.TabIndex = 100 + i; //varLabel.Text = "VOLUME_FLOW_RATE"; varLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; varLabel.InitializeVariable((ProcessVar)varList[i]); this.Controls.Add(varLabel); } this.Size = new System.Drawing.Size(192, varLabels.Length * 20); this.ResumeLayout(false); }
protected int initializeGrid(SolvableControl ctrl, int columnIndex, Boolean bValueOnly, string ctrlType) { ProcessVar var; ProcessVarLabel label; ProcessVarTextBox valueTextBox; ArrayList varList; Label typeLabel, nameLabel; int counter, extraRowCount; varList = ctrl.Solvable.VarList; if (ctrlType.Length != 0) { typeLabel = new Label(); typeLabel.Size = new System.Drawing.Size(192, 20); typeLabel.Dock = DockStyle.Fill; typeLabel.Anchor = AnchorStyles.Left; typeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; typeLabel.Text = ctrlType; typeLabel.BackColor = Color.DarkGray; nameLabel = new Label(); nameLabel.Size = new System.Drawing.Size(80, 20); nameLabel.Dock = DockStyle.Fill; nameLabel.Anchor = AnchorStyles.Left; nameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; nameLabel.Text = ctrl.Solvable.ToString(); nameLabel.BackColor = Color.DarkGray; if (bValueOnly) { this.tableLayoutPanel.ColumnCount = columnIndex + 1; this.tableLayoutPanel.Controls.Add(nameLabel, columnIndex, 0); } else { this.tableLayoutPanel.ColumnCount = columnIndex + 2; this.tableLayoutPanel.Controls.Add(typeLabel, columnIndex, 0); this.tableLayoutPanel.Controls.Add(nameLabel, columnIndex + 1, 0); } extraRowCount = 1; } else { extraRowCount = 0; } // set the property names and values for (counter = 0; counter < varList.Count; counter++) { var = varList[counter] as ProcessVar; if (var == null) { continue; } valueTextBox = new ProcessVarTextBox(); valueTextBox.Size = new System.Drawing.Size(80, 20); valueTextBox.Dock = DockStyle.Fill; valueTextBox.Anchor = AnchorStyles.Left & AnchorStyles.Right & AnchorStyles.Top & AnchorStyles.Bottom; valueTextBox.InitializeVariable(solvableCtrl.Flowsheet.ApplicationPrefs, var); if (bValueOnly) { this.tableLayoutPanel.Controls.Add(valueTextBox, columnIndex, counter + extraRowCount); } else { label = new ProcessVarLabel(); label.Anchor = System.Windows.Forms.AnchorStyles.Left; label.Size = new System.Drawing.Size(192, 20); label.AutoSize = false; //label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; label.Dock = DockStyle.Fill; label.Text = var.VarTypeName; label.InitializeVariable(var); this.tableLayoutPanel.Controls.Add(label, columnIndex, counter + extraRowCount); this.tableLayoutPanel.Controls.Add(valueTextBox, columnIndex + 1, counter + extraRowCount); } this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 24F)); } if (this.tableLayoutPanel.RowCount < counter + extraRowCount) { this.tableLayoutPanel.RowCount = counter + extraRowCount; } return(counter + extraRowCount); }