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; using WinFormControl; namespace Test { public partial class Form1 : Form { List list = new List(); public Form1() { InitializeComponent(); comboBox1.DataSource = Enum.GetNames(typeof(SoundType)); uDataGridView1.AutoGenerateColumns = false; for (var i = 1; i <= 20; i++) { list.Add(new Sut { ID = i, Name = i.ToString() }); } uDataGridView1.DataSource = list; uDataGridView1.Refresh(); } private void uWeightControl1_ReceivedValue(decimal obj) { MessageBox.Show(obj.ToString()); } private void uScanPanel1_BeforeScan() { //throw new Exception("dddddd"); } private void uScanPanel1_AfterScan() { MessageBox.Show(uScanPanel1.TextBox.Text); } private void uButton1_Click(object sender, EventArgs e) { //SoundType sy; //if (Enum.TryParse(comboBox1.SelectedValue.ToString(), out sy)) // SoundPalyUtil.PlaySound(sy); } //int clickIdx; private void uDataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { //if (e.Button == MouseButtons.Left) // clickIdx = e.RowIndex; } private void uDataGridView1_CellMouseMove(object sender, DataGridViewCellMouseEventArgs e) { //if (e.Button != MouseButtons.Left || e.RowIndex < 0) // return; //if (clickIdx != e.RowIndex) //{ // var add = clickIdx - e.RowIndex; // if (add > 0) // add += 1; // var fRowIdx = uDataGridView1.FirstDisplayedScrollingRowIndex + add; // uScanPanel1.TextBox.Text = add.ToString(); // if (fRowIdx < 0 || fRowIdx > uDataGridView1.RowCount - 1) // return; // uDataGridView1.FirstDisplayedScrollingRowIndex = fRowIdx; //} } private void uDataGridView1_DragDrop(object sender, DragEventArgs e) { //MessageBox.Show("dd"); } } class Sut { public long ID { get; set; } public string Name { get; set; } } }