Select multiple Rows without pressing Control Key

后端 未结 6 1754
日久生厌
日久生厌 2021-01-19 07:36

I have a gridview where I can select multiple rows by pressing a control key. Is it possible to achieve the same without pressing a control key.

6条回答
  •  梦谈多话
    2021-01-19 08:12

    I know this reply is a bit late but for everyone..

    you can use InputSimulator and do this:

    InputSimulator sim = new InputSimulator();
    
    
        private void CommandeDataGridView_MouseHover(object sender, EventArgs e)
        {
            sim.Keyboard.KeyDown(WindowsInput.Native.VirtualKeyCode.LCONTROL);
        }
    
        private void CommandeDataGridView_MouseLeave(object sender, EventArgs e)
        {
            sim.Keyboard.KeyUp(WindowsInput.Native.VirtualKeyCode.LCONTROL);
        }
    

提交回复
热议问题