8,735
社区成员
发帖
与我相关
我的任务
分享
public class Areas : Canvas
{
public Areas()
{
this.MouseMove += new MouseEventHandler(Areas_MouseMove);
UIElement target = this as UIElement;
target.AddHandler(UIElement.KeyDownEvent, new KeyEventHandler(Areas_KeyDown), true);
this.MouseLeftButtonUp += new MouseButtonEventHandler(Areas_MouseLeftButtonUp);
this.KeyDown+=new KeyEventHandler(Areas_KeyDown);
}
void Areas_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key.ToString() == "Left")
{
MessageBox.Show("按下左键!");
//BindCursorData(mydraw.DrawCursor(this.panel1, true));
}
else if (e.Key.ToString() == "Right")
{
MessageBox.Show("按下右键!");
//BindCursorData(mydraw.DrawCursor(this.panel1, false));
}
}
}