比如form1_KeyDown(object sender, KeyEventArgs e)怎摸调用?
用form1_KeyDown(null,null);会报未将对象实例化.

解决方案 »

  1.   

    在form1里调吗?具体那句报错?
      
    *****************************************************************************
    欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) 
    http://feiyun0112.cnblogs.com/
      

  2.   

    当然能调用方法:
    form1_KeyDown(sender, e)调用前先对sender和e进行处理
      

  3.   

    当执行private void form1_KeyDown(object sender, KeyEventArgs e)
    {
    if( e.shift==true;)
    }执行到e.shift==true是会报未将对象实例化.
      

  4.   

    楼上
    怎摸对sender和e进行处理?
      

  5.   

    不如我想获得按下Shift键,怎摸传?
      

  6.   

       public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
                this.KeyPreview = true;//注册窗体的按钮响应
            }        private void Form1_Load(object sender, EventArgs e)
            {        }
            private void Form1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
            {
                if (e.Shift)
                {
                    MessageBox.Show("你按下了shift!");
                }
            }
        }
      

  7.   

    他就是个方法 当然能调用
    “未将对象实例化”很明显应为你传的参数都是null
    至少new 一下吧
      

  8.   

    KeyEventArgs ee = new KeyEventArgs();
    错误 1 “KeyEventArgs”方法没有采用“0”个参数的重载 E:\Demo\KeyShift\WindowsApplication1\WindowsApplication1\Form1.cs 22 31 WindowsApplication1