Exemplo n.º 1
0
 /// <include file='doc\ToolTip.uex' path='docs/doc[@for="ToolTip.ToolTip1"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Initializes a new instance of the <see cref='System.Windows.Forms.ToolTip'/> class in its default state.
 ///    </para>
 /// </devdoc>
 public ToolTip()
 {
     window = new ToolTipNativeWindow(this);
     auto   = true;
     delayTimes[NativeMethods.TTDT_AUTOMATIC] = DEFAULT_DELAY;
     AdjustBaseFromAuto();
 }
 public ToolTip()
 {
     this.tools = new Hashtable();
     this.delayTimes = new int[4];
     this.auto = true;
     this.active = true;
     this.backColor = SystemColors.Info;
     this.foreColor = SystemColors.InfoText;
     this.toolTipTitle = string.Empty;
     this.owners = new Hashtable();
     this.useAnimation = true;
     this.useFading = true;
     this.created = new Hashtable();
     this.window = new ToolTipNativeWindow(this);
     this.auto = true;
     this.delayTimes[0] = 500;
     this.AdjustBaseFromAuto();
 }
Exemplo n.º 3
0
Arquivo: Form.cs Projeto: mind0n/hive
 public void Dispose() {
     if (owner != null) {
         owner.LocationChanged -= new EventHandler(FormLocationChanged);
     }
     if (window.Handle != IntPtr.Zero) {
         window.DestroyHandle();
         window = null;
     }
 }
Exemplo n.º 4
0
Arquivo: Form.cs Projeto: mind0n/hive
 internal SecurityToolTip(Form owner) {
     this.owner = owner;
     SetupText();
     window = new ToolTipNativeWindow(this);
     SetupToolTip();
     owner.LocationChanged += new EventHandler(FormLocationChanged);
     owner.HandleCreated += new EventHandler(FormHandleCreated);
 }
Exemplo n.º 5
0
 /// <include file='doc\StatusBar.uex' path='docs/doc[@for="StatusBar.ControlToolTip.ControlToolTip"]/*' />
 /// <devdoc>
 ///    Creates a new ControlToolTip.
 /// </devdoc>
 public ControlToolTip(Control parent) {
     window = new ToolTipNativeWindow(this);
     this.parent = parent;
 }
Exemplo n.º 6
0
 /// <include file='doc\ToolTip.uex' path='docs/doc[@for="ToolTip.ToolTip1"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Initializes a new instance of the <see cref='System.Windows.Forms.ToolTip'/> class in its default state.
 ///    </para>
 /// </devdoc>
 public ToolTip() {
     window = new ToolTipNativeWindow(this);
     auto = true;
     delayTimes[NativeMethods.TTDT_AUTOMATIC] = DEFAULT_DELAY;
     AdjustBaseFromAuto();
 }
Exemplo n.º 7
0
        /// <include file='doc\ToolTip.uex' path='docs/doc[@for="ToolTip.Dispose"]/*' />
        /// <internalonly/>
        /// <devdoc>
        ///    <para>
        ///       Disposes of the <see cref='System.Windows.Forms.ToolTip'/>
        ///       component.
        ///    </para>
        /// </devdoc>
        protected override void Dispose(bool disposing) {
            
            if (disposing) {
                this.isDisposing = true;
                try {
                    ClearTopLevelControlEvents();
                    StopTimer();

                    // always destroy the handle...
                    //
                    DestroyHandle();
                    RemoveAll();

                    window = null;

                    //Unhook the DeactiveEvent...
                    // Lets find the Form for associated Control ...
                    // and hook up to the Deactivated event to Hide the Shown tooltip
                    Form baseFrom = TopLevelControl as Form;
                    if (baseFrom != null) {
                        baseFrom.Deactivate -= new EventHandler(this.BaseFormDeactivate);
                    }
                }
                finally {
                    this.isDisposing = false;
                }
            }  
            base.Dispose(disposing);
        }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         this.isDisposing = true;
         try
         {
             this.ClearTopLevelControlEvents();
             this.StopTimer();
             this.DestroyHandle();
             this.RemoveAll();
             this.window = null;
             Form topLevelControl = this.TopLevelControl as Form;
             if (topLevelControl != null)
             {
                 topLevelControl.Deactivate -= new EventHandler(this.BaseFormDeactivate);
             }
         }
         finally
         {
             this.isDisposing = false;
         }
     }
     base.Dispose(disposing);
 }
 private unsafe void WmWindowPosChanging(ref Message m)
 {
     if (!this.cancelled)
     {
         System.Windows.Forms.NativeMethods.WINDOWPOS* lParam = (System.Windows.Forms.NativeMethods.WINDOWPOS*) m.LParam;
         Cursor currentInternal = Cursor.CurrentInternal;
         Point position = Cursor.Position;
         System.Windows.Forms.NativeMethods.TOOLINFO_TOOLTIP toolinfo_tooltip = new System.Windows.Forms.NativeMethods.TOOLINFO_TOOLTIP {
             cbSize = Marshal.SizeOf(typeof(System.Windows.Forms.NativeMethods.TOOLINFO_TOOLTIP))
         };
         if (((int) System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, this.Handle), System.Windows.Forms.NativeMethods.TTM_GETCURRENTTOOL, 0, toolinfo_tooltip)) != 0)
         {
             IWin32Window window = (IWin32Window) this.owners[toolinfo_tooltip.hwnd];
             if (window == null)
             {
                 window = Control.FromHandleInternal(toolinfo_tooltip.hwnd);
             }
             if ((window == null) || !this.IsWindowActive(window))
             {
                 return;
             }
             TipInfo info = null;
             if (window != null)
             {
                 info = (TipInfo) this.tools[window];
                 if (info == null)
                 {
                     return;
                 }
                 TreeView view = window as TreeView;
                 if ((view != null) && view.ShowNodeToolTips)
                 {
                     return;
                 }
             }
             if (this.IsBalloon)
             {
                 lParam->cx += 20;
                 return;
             }
             if ((info.TipType & TipInfo.Type.Auto) != TipInfo.Type.None)
             {
                 this.window.DefWndProc(ref m);
                 return;
             }
             if (((info.TipType & TipInfo.Type.SemiAbsolute) != TipInfo.Type.None) && (info.Position == Point.Empty))
             {
                 Screen screen = Screen.FromPoint(position);
                 if (currentInternal != null)
                 {
                     lParam->x = position.X;
                     try
                     {
                         System.Windows.Forms.IntSecurity.ObjectFromWin32Handle.Assert();
                         lParam->y = position.Y;
                         if ((((lParam->y + lParam->cy) + currentInternal.Size.Height) - currentInternal.HotSpot.Y) > screen.WorkingArea.Bottom)
                         {
                             lParam->y = position.Y - lParam->cy;
                         }
                         else
                         {
                             lParam->y = (position.Y + currentInternal.Size.Height) - currentInternal.HotSpot.Y;
                         }
                     }
                     finally
                     {
                         CodeAccessPermission.RevertAssert();
                     }
                 }
                 if ((lParam->x + lParam->cx) > screen.WorkingArea.Right)
                 {
                     lParam->x = screen.WorkingArea.Right - lParam->cx;
                 }
             }
             else if (((info.TipType & TipInfo.Type.SemiAbsolute) != TipInfo.Type.None) && (info.Position != Point.Empty))
             {
                 Screen screen2 = Screen.FromPoint(info.Position);
                 lParam->x = info.Position.X;
                 if ((lParam->x + lParam->cx) > screen2.WorkingArea.Right)
                 {
                     lParam->x = screen2.WorkingArea.Right - lParam->cx;
                 }
                 lParam->y = info.Position.Y;
                 if ((lParam->y + lParam->cy) > screen2.WorkingArea.Bottom)
                 {
                     lParam->y = screen2.WorkingArea.Bottom - lParam->cy;
                 }
             }
         }
         m.Result = IntPtr.Zero;
     }
 }
 private void WmPop()
 {
     System.Windows.Forms.NativeMethods.TOOLINFO_TOOLTIP lParam = new System.Windows.Forms.NativeMethods.TOOLINFO_TOOLTIP {
         cbSize = Marshal.SizeOf(typeof(System.Windows.Forms.NativeMethods.TOOLINFO_TOOLTIP))
     };
     if (((int) System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, this.Handle), System.Windows.Forms.NativeMethods.TTM_GETCURRENTTOOL, 0, lParam)) != 0)
     {
         IWin32Window window = (IWin32Window) this.owners[lParam.hwnd];
         if (window == null)
         {
             window = Control.FromHandleInternal(lParam.hwnd);
         }
         if (window != null)
         {
             Control key = window as Control;
             TipInfo info = (TipInfo) this.tools[window];
             if (info != null)
             {
                 if (((info.TipType & TipInfo.Type.Auto) != TipInfo.Type.None) || ((info.TipType & TipInfo.Type.SemiAbsolute) != TipInfo.Type.None))
                 {
                     Screen screen = Screen.FromPoint(Cursor.Position);
                     System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, this.Handle), 0x418, 0, screen.WorkingArea.Width);
                 }
                 if ((info.TipType & TipInfo.Type.Auto) == TipInfo.Type.None)
                 {
                     this.tools.Remove(key);
                     this.owners.Remove(window.Handle);
                     key.HandleCreated -= new EventHandler(this.HandleCreated);
                     key.HandleDestroyed -= new EventHandler(this.HandleDestroyed);
                     this.created.Remove(key);
                     if (this.originalPopupDelay != 0)
                     {
                         this.AutoPopDelay = this.originalPopupDelay;
                         this.originalPopupDelay = 0;
                     }
                 }
                 else
                 {
                     info.TipType = TipInfo.Type.Auto;
                     info.Position = Point.Empty;
                     this.tools[key] = info;
                 }
             }
         }
     }
 }
 private void WmMove()
 {
     System.Windows.Forms.NativeMethods.RECT rect = new System.Windows.Forms.NativeMethods.RECT();
     System.Windows.Forms.UnsafeNativeMethods.GetWindowRect(new HandleRef(this, this.Handle), ref rect);
     System.Windows.Forms.NativeMethods.TOOLINFO_TOOLTIP lParam = new System.Windows.Forms.NativeMethods.TOOLINFO_TOOLTIP {
         cbSize = Marshal.SizeOf(typeof(System.Windows.Forms.NativeMethods.TOOLINFO_TOOLTIP))
     };
     if (((int) System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, this.Handle), System.Windows.Forms.NativeMethods.TTM_GETCURRENTTOOL, 0, lParam)) != 0)
     {
         IWin32Window window = (IWin32Window) this.owners[lParam.hwnd];
         if (window == null)
         {
             window = Control.FromHandleInternal(lParam.hwnd);
         }
         if (window != null)
         {
             TipInfo info = (TipInfo) this.tools[window];
             if ((window != null) && (info != null))
             {
                 TreeView view = window as TreeView;
                 if (((view == null) || !view.ShowNodeToolTips) && (info.Position != Point.Empty))
                 {
                     this.Reposition(info.Position, rect.Size);
                 }
             }
         }
     }
 }