我想实现点击键盘的ctrl键,同时鼠标点击label控件,才能实现事件响应,该如何实现,求大神指点.

解决方案 »

  1.   

    再详细点,在window form上实现.
      

  2.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            bool d = false;
            public Form1()
            {
                InitializeComponent();
            }
            
            private void label1_Click(object sender, EventArgs e)
            {
                if (d)
                {
                    MessageBox.Show("", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                }        }        private void Form1_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyValue == 17)
                    d = true;        }
        }
    }
      

  3.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            bool d = false;
            public Form1()
            {
                InitializeComponent();
            }
            
            private void label1_Click(object sender, EventArgs e)
            {
                if (d)
                {
                    MessageBox.Show("", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                }        }        private void Form1_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyValue == 17)
                    d = true;        }        private void Form1_KeyUp(object sender, KeyEventArgs e)
            {
                if (e.KeyValue == 17)
                    d = false ;
            }
        }
    }
      

  4.   

    检查下,焦点是不是被TextBox之类的控件捕获掉了
      

  5.   


    private void label1_Click(object sender, EventArgs e)
    {
        if(ModifierKeys == Keys.Control) MessageBox.Show("");
    }