public ArrayList LoadConditionList(Objects.Condition[] cs) { List <Interfaces.INeedTranslatedValue> iNeedTranslatedValueList = new List <QuickReportCore.Interfaces.INeedTranslatedValue>(); List <Interfaces.INeedQuery> iNeedQueryList = new List <QuickReportCore.Interfaces.INeedQuery>(); conditions = cs; ucShouldShowList = new ucReportCondition[conditions.Length]; conditionValueProvidor = new Hashtable(); for (int i = 0; i < conditions.Length; i++) { Objects.Condition c = conditions[i]; ucReportCondition uc = new ucReportCondition(); uc.EnterCondition += new ucReportCondition.EnterConditionHandle(uc_EnterCondition); uc.Condition = c; uc.TabIndex = i; if (uc.EditControl is QuickReportCore.Interfaces.INeedTranslatedValue) { iNeedTranslatedValueList.Add(uc.EditControl as QuickReportCore.Interfaces.INeedTranslatedValue); } if (uc.EditControl is QuickReportCore.Interfaces.INeedQuery) { iNeedQueryList.Add(uc.EditControl as QuickReportCore.Interfaces.INeedQuery); } ucShouldShowList[i] = uc; conditionValueProvidor.Add(Managers.Functions.GetSQLCode(c.ID, QuickReportCore.Managers.Functions.SQLCodeType.Condition), uc); } ArrayList al = new ArrayList(); al.Add(iNeedTranslatedValueList); al.Add(iNeedQueryList); return(al); }
public void ShowConditions() { if (ucShouldShowList == null) { return; } int widthUsed = 0; int pageIndex = 0; htPanels = new Hashtable(); pnlOfPnl.Controls.Clear(); Panel p = new Panel(); pnlOfPnl.Controls.Add(p); p.Dock = DockStyle.Fill; htPanels.Add(pageIndex, p); int totalWidth = p.Width; for (int i = 0; i < ucShouldShowList.Length; i++) { ucReportCondition uc = ucShouldShowList[i]; if (uc == null) { goto End; } uc.ShowAndOrState = true; if (i == ucShouldShowList.Length - 1) { uc.ShowAndOrState = false; } if (widthUsed == 0) { ((Panel)htPanels[pageIndex]).Controls.Add(uc); int x = leftM; int y = topM; if (uc.Location != new Point(x, y)) { uc.Location = new Point(x, y); } widthUsed = x + uc.Width; uc.PageIndex = pageIndex; continue; } else { if (uc.Width + widthUsed + eatchMH < totalWidth - rightM) { ((Panel)htPanels[pageIndex]).Controls.Add(uc); int x = widthUsed + eatchMH; int y = topM; if (uc.Location != new Point(x, y)) { uc.Location = new Point(x, y); } widthUsed = x + uc.Width; uc.PageIndex = pageIndex; } else { pageIndex++; Panel panel = new Panel(); pnlOfPnl.Controls.Add(panel); panel.Dock = DockStyle.Fill; htPanels.Add(pageIndex, panel); ((Panel)htPanels[pageIndex]).Controls.Add(uc); int x = leftM; int y = topM; if (uc.Location != new Point(x, y)) { uc.Location = new Point(x, y); } widthUsed = x + uc.Width; uc.PageIndex = pageIndex; } } } End: for (int i = htPanels.Count - 1; i >= 0; i--) { ((Panel)htPanels[i]).BringToFront(); } if (htPanels.Count <= 1) { vScrollBar.Visible = false; } else { vScrollBar.Maximum = htPanels.Count * 10; vScrollBar.Value = 0; vScrollBar.Visible = true; } }