سؤال

private void timer1_Tick(object sender, EventArgs e)
{

       MouseEventArgs m=e as MouseEventArgs;
        if (m.Button == MouseButtons.Right)
        {
            MessageBox.Show("dfgdf");
        }
}

It dont work How can I do it ?

هل كانت مفيدة؟

المحلول

MouseEventArgs are, as stated by their name, arguments that come from mouse events. (such as MouseDown or MouseUp)

Each Event has his own EventAgs. Therefore, you can't use MouseEventArgs in your Timer.Tick event.

Here is the EventArgs class.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top