wpf 与winform获取鼠标左右键焦点的差异
- winform中以Panel为例的MouseDown事件为:
private void panelposition_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
//判断鼠标左键按下
if(e.Button == System.Windows.Forms.MouseButtons.Left){//...}
//判断鼠标左键按下
if(e.Button == System.Windows.Forms.MouseButtons.Right){//...}
} - wpf中以Image为例的MouseDown事件为:
private void imageposition_MouseDown(object sender, MouseButtonEventArgs e)
{
//判断鼠标左键按下
if(e.LeftButton == MouseButtonState.Pressed){//...}
//判断鼠标左键按下
if(e.RightButton == MouseButtonState.Pressed){//...}
}