刚学C#,1.怎样判断用户同时按下了AIT+N键?2.怎样将屏幕上(200,300)那个点设置成红色?
水平很低,谢谢!越详细越好!

解决方案 »

  1.   

    放置一个按钮,其Text属性为:按键(&N)
    双击按钮,在Click事件中加入MessageBox.Show("同时按下了AIT+N键");
    F5调试运行
      

  2.   

    http://www.microsoft.com/china/msdn/events/webcasts/shared/webcast/msdnwebcast.aspx把【8月3日  《.NET Windows编程系列课程(9):程序交互》 邵志东 】那个视频下来看了你就会了。
      

  3.   

    1:在KeyDown事件中判断
     if(e.KeyCode == Keys.N && e.Modifiers == Keys.Alt)
      

  4.   

    1:在KeyDown事件中判断。
       窗体keyPerview属性为True
      if(e.KeyCode.ToString() == "N"  && e.Alt == true)
      

  5.   

    这样试试看:protected override bool ProcessDialogKey(Keys keyData)
    {
    if (keyData ==(Keys.Alt|Keys.N))
    {
    using (Graphics g = this.CreateGraphics())
    {
    using (SolidBrush brush = new SolidBrush(Color.Red))
    {
    g.FillEllipse(brush, Rectangle.FromLTRB(200 - 1, 300 - 1, 200 + 1, 300 + 1));
    }
    }
    }
    return base.ProcessDialogKey(keyData);
    }
      

  6.   

    若要持久在窗体上显示这个红点,那么要在Paint方法或事件里处理,例如:protected override void OnPaint(PaintEventArgs e)
    {
    base.OnPaint(e);
    using (SolidBrush brush = new SolidBrush(Color.Red))
    {
    e.Graphics.FillEllipse(brush, Rectangle.FromLTRB(200 - 1, 300 - 1, 200 + 1, 300 + 1));
    }
    }
      

  7.   

    if(e.KeyCode.ToString() == "N" && e.Alt == true)
    这个应该是不行的,按下一个就会响应了,不可能绝对意义上的同时protected override bool ProcessDialogKey(Keys keyData)
    {
    if (keyData ==(Keys.Alt|Keys.N))
    {
    using (Graphics g = this.CreateGraphics())
    {
    using (SolidBrush brush = new SolidBrush(Color.Red))
    {
    g.FillEllipse(brush, Rectangle.FromLTRB(200 - 1, 300 - 1, 200 + 1, 300 + 1));
    }
    }
    }
    return base.ProcessDialogKey(keyData);
    }
    这个应该没错
      

  8.   

    KeyDown事件中 if(e.KeyCode == Keys.N && e.Modifiers == Keys.Alt)
    using (SolidBrush brush = new SolidBrush(Color.Red))
    {
    g.FillEllipse(brush, Rectangle.FromLTRB(200 - 1, 300 - 1, 200 + 1, 300 + 1));
    }
      

  9.   

    1. 在KeyDown event里
            private void Form1_KeyDown(object sender, KeyEventArgs e)
            {
                if(e.KeyCode==Keys.N&&e.Alt)
                {
                    Text="OK";
                }
            }
    2. 看上边的