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)