using ButcherFactory.BO.LocalBL; using ButcherFactory.Controls; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ButcherFactory.Dialogs { public partial class SelectStoreDialog : Form { public Tuple Result; public SelectStoreDialog() { InitializeComponent(); var stores = DialogBL.GetStoreList(); var flw = new FlowLayoutPanel() { Dock = DockStyle.Fill }; Color color = Color.FromArgb(77, 135, 245); foreach (var item in stores) { var btn = new ColorButton() { Width = 100, Height = 60, Text = item.StringExt1.ToString(), Tag = item.LongExt1, BackColor = color, Font = new Font("宋体", 10), Margin = new Padding(12) }; btn.Click += BtnClick; flw.Controls.Add(btn); } this.Controls.Add(flw); } private void BtnClick(object sender, EventArgs e) { var btn = sender as ColorButton; Result = new Tuple(btn.Text, Convert.ToInt64(btn.Tag)); DialogResult = DialogResult.OK; this.Close(); } } }