如果我想在一个方法里调用KeyPress方法,但我知道该如果加KeyPress的参数~~!!
例如:private void PP_KeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar=='f') this.Dispose();
}private void locationreset()
{
this.PP_KeyPress(__________);
}就是括号中下划线的部份!
谢谢~~!!

解决方案 »

  1.   

    private void PP_KeyPress(object sender, KeyPressEventArgs e)
    {
    if(e.KeyChar=='f') this.Dispose();
    }private void locationreset()
    {
    this.PP_KeyPress(sender,e);
      

  2.   

    this.PP_KeyPress(null,null);
    如果在PP_KeyPress用到了e
    你可以在
    locationreset里面new一个KeyPressEventArgs
      

  3.   

    如果this.PP_KeyPress(sender,e); 返回的错误说:sender(e)在类或命名空间内不存在!如果 new 一个 KeyPressEventArgs 可否说的再详细些!?
      

  4.   

    this.PP_KeyPress(sender, e);
    这里的e要是一个已经声明过的从键盘上动作上得来得参数.
      

  5.   

    就是应该用一个KeyPressEventArgs的一个实例来代替e
      

  6.   

    这种情况下,你最好把KeyPress里的处理方法另写成一个方法,再别的地方直接调用该方法。
      

  7.   

    呵呵,谢谢了!!问题已经通过其它的方法解决了!!不过话又说回来,为什么在这种情况下最好把KeyPress方法写成另一个方法再调用呢!?