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 B3ButcherWeightClient
|
|
{
|
|
public partial class ChangeLevelForm : Form
|
|
{
|
|
|
|
readonly IList<Livestock.Info> _dTable = new List<Livestock.Info>();
|
|
|
|
readonly IList<Button> _btList = new List<Button>();
|
|
|
|
public ChangeLevelForm()
|
|
{
|
|
InitializeComponent();
|
|
this.Text = "替换--" + mName;
|
|
}
|
|
|
|
public long mID { get; set; }
|
|
public string mName { get; set; }
|
|
public void Init( string name)
|
|
{
|
|
mName = name;
|
|
}
|
|
|
|
private void ChangeLevelForm_Load(object sender, EventArgs e)
|
|
{
|
|
AddLivestockControl();
|
|
}
|
|
|
|
private void AddLivestockControl()
|
|
{
|
|
ConfigUtil.SetLivestock(_dTable);
|
|
var i = 0;
|
|
var j = 0;
|
|
foreach (var info in _dTable)
|
|
{
|
|
var bt = new Button();
|
|
bt.Text = info.名称;
|
|
bt.Size = new Size(200, 100);
|
|
bt.Left = i * 203;
|
|
bt.Top = j * 102;
|
|
bt.Tag = info;
|
|
bt.Click += Bt_Click; ;
|
|
panel1.Controls.Add(bt);
|
|
_btList.Add(bt);
|
|
i++;
|
|
if (i == 3)
|
|
{
|
|
i = 0;
|
|
j++;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void Bt_Click(object sender, EventArgs e)
|
|
{
|
|
var bt = sender as Button;
|
|
if (bt != null)
|
|
{
|
|
bt.BackColor = Color.OrangeRed;
|
|
var _currentInfo = bt.Tag as Livestock.Info;
|
|
mID = _currentInfo.ID;
|
|
mName = _currentInfo.名称;
|
|
DialogResult=DialogResult.OK;
|
|
}
|
|
}
|
|
}
|
|
}
|