读书人

C#鼠标单击事件代码有关问题

发布时间: 2013-02-19 11:11:40 作者: rapoo

C#鼠标单击事件代码问题


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfBrowserApplication1
{
/// <summary>
/// Interaction logic for Page1.xaml
/// </summary>
public partial class Page1 : Page
{
public Page1()
{
InitializeComponent();
}

private void button1_MouseDown(object sender, MouseEventArgs e)
{

if (e.Button == MouseButtons.Left)
{
MessageBox.Show("left");
}
else
{
MessageBox.Show("right");
}
}
}
}

第31行Button和MouseButtons不对,新人求指教。是不是少加载什么类了啊? c# button
[解决办法]
那是System.Windows.Forms命名空间的
http://www.soaspx.com/dotnet/csharp/csharp_20120213_8566.html
[解决办法]
if (e.Button == MouseButtons.Left) //这是winform用的吧


try

if (e.LeftButton == MouseButtonState.Pressed)

读书人网 >C#

热点推荐