1
0

Program.cs 598 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using System.Reactive.Linq;
  3. using System.Windows.Forms;
  4. namespace Excercise3
  5. {
  6. class Program
  7. {
  8. static void Main()
  9. {
  10. var lbl = new Label();
  11. var frm = new Form()
  12. {
  13. Controls = { lbl }
  14. };
  15. var moves = Observable.FromEventPattern<MouseEventArgs>(frm, "MouseMove");
  16. using (moves.Subscribe(evt =>
  17. {
  18. lbl.Text = evt.EventArgs.Location.ToString();
  19. }))
  20. {
  21. Application.Run(frm);
  22. }
  23. }
  24. }
  25. }