using PaintingPC; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace PaintingPC { public delegate Panel InitPanel(Panel BackgroundPanel, int LabelSizeW, int LabelSizeH, DataTable dataSouce, string LabelTextCol, string LabelTagCol, EventHandler LabelClick); public partial class FrmChainUp : Form { string CartypeID = ""; string CartypeName = ""; string ColorID = ""; string ColorName = ""; InitPanel ip; Interface1 ii = new Function(); public FrmChainUp() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Environment.Exit(0); } private void FrmChainUp_Load(object sender, EventArgs e) { //ip = ii.IInitPanel; InitPage(); } public void InitPage() { try { InitButton(200, 150); } catch (Exception ex) { } } private void InitButton(int sizeW, int sizeH) { DataTable dt = Function.GetCarTypeAll(); ip(panel5, 200, 150, dt, "Type", "Type", dLbLable_Click); } void dLbLable_Click(object sender, EventArgs e) { Label label = (Label)sender; CartypeID = label.Tag.ToString(); CartypeName = label.Text.Trim(); //根据车型ID查询颜色,生成按钮于panel5 DataTable dt = Function.GetColorByType(CartypeID); ip(panel5, 200, 150, dt, "Color", "Color", dLbColor_Click); } void dLbColor_Click(object sender, EventArgs e) { Label label = (Label)sender; ColorID = label.Tag.ToString(); ColorName = label.Text.Trim(); this.Hide(); //FrmChainUp1 frm = new FrmChainUp1(CartypeID, CartypeName, ColorID, ColorName, ReturnClick); //frm.ShowDialog(); } void ReturnClick(object sender, EventArgs e) { this.Show(); InitPage(); } } }