WebIfaces.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Runtime.InteropServices;
  5. using System.Windows.Forms;
  6. namespace US.Browser.IE
  7. {
  8. #region IHTMLOMWindowServices Interface
  9. [ComVisible(true), ComImport()]
  10. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
  11. [Guid("3050f625-98b5-11cf-bb82-00aa00bdce0b")]
  12. public interface HTMLWindowEvents2
  13. {
  14. void moveTo([In] int x, [In] int y);
  15. void moveBy([In] int x, [In] int y);
  16. void resizeTo([In] int x, [In] int y);
  17. void resizeBy([In] int x, [In] int y);
  18. }
  19. #endregion
  20. public delegate void HTMLOMWindowServicesEventHandler(object sender, HTMLOMWindowServicesEventArgs e);
  21. public class HTMLOMWindowServicesEventArgs : System.EventArgs
  22. {
  23. public HTMLOMWindowServicesEventArgs() { }
  24. public void SetParameters(int _x, int _y)
  25. {
  26. this.X = _x;
  27. this.Y = _y;
  28. }
  29. public int X = 0;
  30. public int Y = 0;
  31. }
  32. public class WebIfaces : WebBrowser, HTMLWindowEvents2
  33. {
  34. public event HTMLOMWindowServicesEventHandler HTMLOMWindowServices_moveTo = null;
  35. public event HTMLOMWindowServicesEventHandler HTMLOMWindowServices_moveBy = null;
  36. public event HTMLOMWindowServicesEventHandler HTMLOMWindowServices_resizeTo = null;
  37. public event HTMLOMWindowServicesEventHandler HTMLOMWindowServices_resizeBy = null;
  38. private HTMLOMWindowServicesEventArgs HTMLOMWindowServicesEvent = new HTMLOMWindowServicesEventArgs();
  39. #region IHTMLOMWindowServices Members
  40. void HTMLWindowEvents2.moveTo(int x, int y)
  41. {
  42. if (HTMLOMWindowServices_moveTo != null)
  43. {
  44. HTMLOMWindowServicesEvent.SetParameters(x, y);
  45. HTMLOMWindowServices_moveTo(this, HTMLOMWindowServicesEvent);
  46. }
  47. }
  48. void HTMLWindowEvents2.moveBy(int x, int y)
  49. {
  50. if (HTMLOMWindowServices_moveBy != null)
  51. {
  52. HTMLOMWindowServicesEvent.SetParameters(x, y);
  53. HTMLOMWindowServices_moveBy(this, HTMLOMWindowServicesEvent);
  54. }
  55. }
  56. void HTMLWindowEvents2.resizeTo(int x, int y)
  57. {
  58. if (HTMLOMWindowServices_resizeTo != null)
  59. {
  60. HTMLOMWindowServicesEvent.SetParameters(x, y);
  61. HTMLOMWindowServices_resizeTo(this, HTMLOMWindowServicesEvent);
  62. }
  63. }
  64. void HTMLWindowEvents2.resizeBy(int x, int y)
  65. {
  66. if (HTMLOMWindowServices_resizeBy != null)
  67. {
  68. HTMLOMWindowServicesEvent.SetParameters(x, y);
  69. HTMLOMWindowServices_resizeBy(this, HTMLOMWindowServicesEvent);
  70. }
  71. }
  72. #endregion
  73. }
  74. }