public void AddSupplDocLine(SupplDocLine slNewLine) { Array.Resize<Control>(ref aSupplDoclines, aSupplDoclines.Length + 1); aSupplDoclines[aSupplDoclines.Length - 1] = slNewLine; slNewLine.Top = 17 + ((iLineRowIndex) * 20); slNewLine.Left = 4; if (slNewLine.txtStore.Text == "") { slNewLine.txtStore.Text = Global.sDefaultStore; } slNewLine.TabIndex = 50 + aSupplDoclines.Length; slNewLine.TabStop = true; slNewLine.iLineIndex = aSupplDoclines.Length - 1; slNewLine.Name = "slNewLine_" + (aSupplDoclines.Length - 1).ToString(); this.pnlDetails.Controls.Add(slNewLine); slNewLine.BringToFront(); iLineRowIndex++; }
public void InsertSalesLine(int iLineIndex, SupplDocLine slNewLine) { for (int iLines = 0; iLines < aSupplDoclines.Length; iLines++) { SupplDocLine slThisline = (((SupplDocLine)aSupplDoclines[iLines])); if (slThisline.iLineIndex == iLineIndex)//start line { Array.Resize<Control>(ref aSupplDoclines, aSupplDoclines.Length + 1);//Add new row iLineRowIndex++; for (int iShiftLines = aSupplDoclines.Length - 1; iShiftLines > iLines + 1; iShiftLines--) { aSupplDoclines[iShiftLines] = aSupplDoclines[iShiftLines - 1]; (((SupplDocLine)aSupplDoclines[iShiftLines])).Location = new Point((((SupplDocLine)aSupplDoclines[iShiftLines - 1])).Location.X, (((SupplDocLine)aSupplDoclines[iShiftLines - 1])).Location.Y + 20); // move location of control to new position (((SupplDocLine)aSupplDoclines[iShiftLines])).iLineIndex++;//sync the lineindex of the control array } aSupplDoclines[iLines + 1] = slNewLine; slNewLine.Top = 17 + ((iLineIndex + 1) * 20); slNewLine.Left = 4; if (slNewLine.txtStore.Text == "") { slNewLine.txtStore.Text = Global.sDefaultStore; } slNewLine.TabIndex = 50 + aSupplDoclines.Length; slNewLine.TabStop = true; slNewLine.iLineIndex = iLines + 1; slNewLine.Name = "slNewLine_" + (aSupplDoclines.Length - 1).ToString(); this.pnlDetails.Controls.Add(slNewLine); slNewLine.BringToFront(); return; } } }