public void Save() { foreach (Control ctrl in pnlFileds.Controls) { if (ctrl is FiledStructure) { FiledStructure fld = (FiledStructure)ctrl; iniFile.IniWriteValue(Company_Info.CompanySerialNumber + " Import Structure", fld.FieldName, fld.Pos + "|" + fld.Length + "|" + fld.Order + "|" + fld.Top); } } }
private FiledStructure GetNext(FiledStructure filed) { foreach (Control ctrl in pnlFileds.Controls) { if (ctrl is FiledStructure) { if ((((FiledStructure)ctrl).Order) == ((filed.Order) + 1)) { return((FiledStructure)ctrl); } } } return(null); }
public void LoadData() { foreach (Control ctrl in pnlFileds.Controls) { if (ctrl is FiledStructure) { FiledStructure fld = (FiledStructure)ctrl; String info = iniFile.IniReadValue(Company_Info.CompanySerialNumber + " Import Structure", fld.FieldName); //fld.Pos + "|" + fld.Length + "|" + fld.Order + "|" + fld.Top if ((info != null) && (info != "")) { string[] parts = info.Split(new string[] { "|" }, StringSplitOptions.None); fld.Pos = Int32.Parse(parts[0]); fld.Length = Int32.Parse(parts[1]); fld.Order = Int32.Parse(parts[2]); fld.Top = Int32.Parse(parts[3]); } } } }
private void SwapFileds(FiledStructure selected_filed_structure, OrderDirection order_direction) { int top = -1; int order = -1; FiledStructure target_filed_structure = null; switch (order_direction) { case OrderDirection.Up: target_filed_structure = GetPrev(selected_filed_structure); if (target_filed_structure != null) { order = selected_filed_structure.Order; top = selected_filed_structure.Top; selected_filed_structure.Top = target_filed_structure.Top; selected_filed_structure.Order = target_filed_structure.Order; target_filed_structure.Top = top; target_filed_structure.Order = order; } break; case OrderDirection.Down: target_filed_structure = GetNext(selected_filed_structure); if (target_filed_structure != null) { order = target_filed_structure.Order; top = target_filed_structure.Top; target_filed_structure.Top = selected_filed_structure.Top; target_filed_structure.Order = selected_filed_structure.Order; selected_filed_structure.Top = top; selected_filed_structure.Order = order; } break; default: break; } }