/// <summary> /// 初始化按钮grid /// </summary> private void dataSource_labels() { string sql = "select * from t_labels where life_cycle = 1 order by id"; buttons = DbUtil.queryButtons(sql); this.dataGridView1.DataSource = DbUtil.queryButtons(sql); this.dataGridView1.ClearSelection(); this.toAdd(); }
/// <summary> /// 初始化按钮 /// </summary> public void data_buttons() { this.panel_button.Controls.Clear(); buttons = DbUtil.queryButtons("select * from t_labels where life_cycle = 1 order by id"); int i = 0; foreach (LabelItem item in buttons) { if (!string.IsNullOrWhiteSpace(item.name)) { Button b = new Button(); b.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); b.Location = new System.Drawing.Point(60 * (i % 5), 30 * (i / 5)); b.Name = item.btn; b.Size = new System.Drawing.Size(52, 23); b.TabIndex = 3; b.Text = item.name; b.UseVisualStyleBackColor = true; b.Click += new System.EventHandler(this.save_btn); this.panel_button.Controls.Add(b); i++; } } }
/// <summary> /// 初始化级别 /// </summary> private void dataSource_labels() { this.combobox_labels.DataSource = DbUtil.queryButtons("select * from t_labels order by id"); this.combobox_labels.DisplayMember = "name"; }