如何将MouseEventArgs和KeyEventArgs输出到文本?
[Serializable]
public enum MacroEventType
{
MouseMove,
MouseDown,
MouseUp,
MouseWheel,
KeyDown,
KeyUp,
KeyPress
}
/// <summary>
/// Series of events that can be recorded any played back
/// </summary>
[Serializable]
public class MacroEvent
{
public MacroEventType MacroEventType;
public EventArgs EventArgs;
public int TimeSinceLastEvent;
public MacroEvent(MacroEventType macroEventType, EventArgs eventArgs, int timeSinceLastEvent)
{
MacroEventType = macroEventType;
EventArgs = eventArgs;
TimeSinceLastEvent = timeSinceLastEvent;
}
}
List<MacroEvent> events = new List<MacroEvent>();
void mouseHook_MouseMove(object sender, MouseEventArgs e)
{
events.Add(
new MacroEvent(
MacroEventType.MouseMove,
e,
Environment.TickCount - lastTimeRecorded
));
lastTimeRecorded = Environment.TickCount;