void button1_Click(object sender, System.EventArgs e) { int wid = _flex.ClientSize.Width; _flex.AutoSizeRows(); // if we added scrollbars because of the autosize, redo it if (wid != _flex.ClientSize.Width) { _flex.AutoSizeRows(); } }
void Form1_Load(object sender, System.EventArgs e) { // bind grid to a data source string conn = GetConnectionString(); OleDbDataAdapter da = new OleDbDataAdapter("select * from products", conn); DataTable dt = new DataTable("Products"); da.Fill(dt); _flex.DataSource = dt; // open categories map da = new OleDbDataAdapter("select * from categories", conn); dt = new DataTable("Categories"); da.Fill(dt); // build data map Hashtable ht = new Hashtable(); foreach (DataRow dr in dt.Rows) { ht.Add(dr["CategoryID"], LoadImage(dr["Picture"] as byte[])); } // assign ImageMap to categories column _flex.Cols["CategoryID"].ImageMap = ht; _flex.Cols["CategoryID"].ImageAndText = false; // finish setting up the grid _flex.Cols[0].Width = _flex.Rows[0].HeightDisplay; _flex.ShowCursor = true; _flex.AutoSizeCols(); _flex.AutoSizeRows(); }
private void frmLabel_Load(object sender, System.EventArgs e) { nav1.cmd_search.Visible = false; nav1.cmd_report.Visible = false; nav1.Grid = vs1; nav1.FormName = this.Name + "_vs1"; nav1.Connection = PublicFunction.C_con; nav1.Init_Control(); nav1.Init_PMenu_Color(); nav1.Show_VS(); nav2.cmd_search.Visible = false; nav2.cmd_report.Visible = false; nav2.Grid = vs2; nav2.FormName = this.Name + "_vs2"; nav2.Connection = PublicFunction.C_con; nav2.Init_Control(); nav2.Init_PMenu_Color(); nav2.Show_VS(LB); nav3.cmd_search.Visible = false; nav3.cmd_report.Visible = false; nav3.Grid = vs3; nav3.FormName = this.Name + "_vs3"; nav3.Connection = PublicFunction.C_con; nav3.Init_Control(); nav3.Init_PMenu_Color(); nav3.Show_VS(); nav4.cmd_search.Visible = false; nav4.cmd_report.Visible = false; nav4.Grid = vs4; nav4.FormName = this.Name + "_vs4"; nav4.Connection = PublicFunction.C_con; nav4.Init_Control(); nav4.Init_PMenu_Color(); nav4.Show_VS(LB); for (int i = 4; i < vs2.Cols.Count - 1; i++) { vs2.Cols[i].Width = 500; // vs2.AllowResizing(); vs2.AutoSizeRows(); } for (int i = 4; i < vs1.Cols.Count - 1; i++) { vs1.Cols[i].Width = 500; vs1.AutoSizeRows(); } for (int i = 4; i < vs4.Cols.Count - 1; i++) { vs4.Cols[i].Width = 500; // vs4.AllowResizing(); vs4.AutoSizeRows(); } // nav5.cmd_search.Visible=false; // nav5.cmd_report.Visible=false; // nav5.Grid=vs5; // nav5.FormName=this.Name+"_vs5"; // nav5.Connection=PublicFunction.C_con; // //// nav5.Init_Control(); //// nav5.Init_PMenu_Color(); //// nav5.Show_VS(RPT); // // nav6.cmd_search.Visible=false; // nav6.cmd_report.Visible=false; // nav6.Grid=vs6; // nav6.FormName=this.Name+"_vs6"; // nav6.Connection=PublicFunction.C_con; // nav6.Init_Control(); // nav6.Init_PMenu_Color(); // nav6.Show_VS(PMENU); }