ChildNativeWindow.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. 
  2. using System.Windows.Forms;
  3. namespace Dongke.WinForm.Controls
  4. {
  5. /// <summary>
  6. /// 控件内部控件
  7. /// </summary>
  8. public class ChildNativeWindow : NativeWindow
  9. {
  10. #region 成员变量
  11. /// <summary>
  12. /// 所属的控件
  13. /// </summary>
  14. private IChildNativeWindow _owner;
  15. #endregion
  16. /// <summary>
  17. ///
  18. /// </summary>
  19. public string Code
  20. {
  21. get;
  22. private set;
  23. }
  24. #region 构造函数
  25. /// <summary>
  26. ///
  27. /// </summary>
  28. /// <param name="owner"></param>
  29. /// <param name="code"></param>
  30. internal ChildNativeWindow(IChildNativeWindow owner, string code)
  31. {
  32. this._owner = owner;
  33. this.Code = code;
  34. }
  35. #endregion
  36. #region 重写方法
  37. /// <summary>
  38. /// 调用与此窗口关联的默认窗口过程
  39. /// </summary>
  40. /// <param name="m"></param>
  41. protected override void WndProc(ref Message m)
  42. {
  43. if (this._owner != null && this._owner.ChildWndProc(this, ref m))
  44. {
  45. // 取消处理
  46. return;
  47. }
  48. base.WndProc(ref m);
  49. }
  50. #endregion
  51. }
  52. }