日期:2014-05-17 浏览次数:21327 次
<Window x:Class="WPF熊俊.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="308" Width="552" >
<Grid Height="202" Name="grid1" Width="325" MouseDown ="button1_MouseDown" PreviewMouseDown="button1_PreviewMouseDown">
<Button Height="23" Name="button1" Width="75" MouseDown="button1_MouseDown" PreviewMouseDown="button1_PreviewMouseDown">button1</Button>
</Grid>
</Window>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void button1_MouseDown(object sender, MouseButtonEventArgs e)
{
MessageBox.Show("MouseDown");
}
private void button1_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
MessageBox.Show("PreviewMouseDown");
}
}