private void UCenterControl_SizeChanged(object sender, EventArgs e) { DataSet ds = um.db.GetPIVAsDB(um.Ssql.GetToolsNameDetail(ToolsMinCategories)); if (ds != null && ds.Tables.Count > 0) { UMinControl umc = new UMinControl(); int count = 0; int h = 0; panel1.Controls.Clear(); panel1.Height = umc.Height; foreach (DataRow dr in ds.Tables[0].Rows) { count = count + 1; umc = new UMinControl(dr, um); if (count * umc.Width <= panel1.Width) { umc.Location = new Point((count - 1) * umc.Width, h); } else { h = h + umc.Height; count = 1; umc.Location = new Point((count - 1) * umc.Width, h); panel1.Height = h + umc.Height; } panel1.Controls.Add(umc); } } this.Height = panel1.Location.Y + panel1.Height; ds.Dispose(); }
public ToolAdd(UMinControl um) { this.um = um; this.uma = um.uma; InitializeComponent(); DataSet ds = db.GetPIVAsDB("select distinct [ToolsMaxCategories] from [dbo].[Tools]"); Comb_MaxCategories.Items.Clear(); Comb_MinCategories.Items.Clear(); foreach (DataRow dr in ds.Tables[0].Rows) { Comb_MaxCategories.Items.Add(dr[0].ToString()); } ds = db.GetPIVAsDB("select distinct [ToolsMinCategories] from [dbo].[Tools]"); foreach (DataRow dr in ds.Tables[0].Rows) { Comb_MinCategories.Items.Add(dr[0].ToString()); } }