0

その中に3列のデータグリッドビューがあります。フォーカスのないデータグリッドビューの最初の列が必要です。誰か助けてください。

4

1 に答える 1

0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DataGridViewValidation.Controls
{
    public class DataGridViewTabColumnFalse : DataGridView
    {
        protected override bool ProcessDataGridViewKey(KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Tab)
            {
                if (CurrentCell.ColumnIndex == 0)
                {
                    e.SuppressKeyPress = true;
                    return true;
                }
            }
            return base.ProcessDataGridViewKey(e);
        }


        protected override bool ProcessDialogKey(Keys keyData)
        {
            if (keyData == Keys.Tab)
            {
                if (CurrentCell.ColumnIndex == 0)
                {
                    return true;
                }
            }

            return base.ProcessDialogKey(keyData);
        }
    }
}
于 2012-12-13T15:52:34.460 に答える