/// <summary> /// Creates a new tool tip and attaches it to the given control. /// </summary> /// <param name="windowManager">The window manager.</param> /// <param name="masterControl">The control to attach the tool tip to.</param> public ToolTip(WindowManager windowManager, XNAControl masterControl) : base(windowManager) { this.masterControl = masterControl ?? throw new ArgumentNullException("masterControl"); masterControl.MouseEnter += MasterControl_MouseEnter; masterControl.MouseLeave += MasterControl_MouseLeave; masterControl.MouseMove += MasterControl_MouseMove; masterControl.EnabledChanged += MasterControl_EnabledChanged; InputEnabled = false; DrawOrder = int.MinValue; // TODO: adding tool tips as root-level controls might be CPU-intensive. // instead we could find out the root-level parent and only have the tooltip // in the window manager's list when the root-level parent is visible. WindowManager.AddControl(this); Visible = false; }