private void HalconWin_HMouseMove(object sender, HMouseEventArgs e) { HTuple Window = new HTuple(); Window = HalconWin.HalconWindow; HTuple Row1, Col1, Button; try { HOperatorSet.GetMposition(Window, out Row1, out Col1, out Button); StatusLblX.Text = Col1.ToString(); StatusLblY.Text = Row1.ToString(); } catch { } }
public SummaryForm() { InitializeComponent(); if (Form1.S.dataGridView1.DataSource != null) { int Col1, Col2; int temp; int selectedCellCount = Form1.S.dataGridView1.GetCellCount(DataGridViewElementStates.Selected); Col1 = Form1.S.dataGridView1.CurrentRow.Cells.IndexOf(Form1.S.dataGridView1.CurrentCell) + 1; Col2 = Form1.S.dataGridView1.SelectedCells[selectedCellCount - 1].ColumnIndex + 1; if (Col1 > Col2) { temp = Col1; Col1 = Col2; Col2 = temp; } textBox_StartCol.Text = Col1.ToString(); textBox_EndCol.Text = Col2.ToString(); //此处+1是为了调整为用户所看到的列数 } int n; if (textBox_EndCol.Text.Trim() == "*") { n = 0; } else { n = Convert.ToInt32(textBox_StartCol.Text); } label_Var1.Text = Form1.S.dataGridView1.Columns[n - 1].HeaderCell.Value.ToString(); if (textBox_EndCol.Text.Trim() == "*") { n = Form1.S.dataGridView1.ColumnCount; } else { n = Convert.ToInt32(textBox_EndCol.Text); } label_Var2.Text = Form1.S.dataGridView1.Columns[n - 1].HeaderCell.Value.ToString(); }