Ejemplo n.º 1
0
        /// <summary>
        /// Make a TOOLINFO structure for the given window
        /// </summary>
        /// <param name="window"></param>
        /// <returns>A filled in TOOLINFO</returns>
        private NativeMethods.TOOLINFO MakeToolInfoStruct(IWin32Window window)
        {
            NativeMethods.TOOLINFO toolinfo_tooltip = new NativeMethods.TOOLINFO();
            toolinfo_tooltip.hwnd     = window.Handle;
            toolinfo_tooltip.uFlags   = TTF_IDISHWND | TTF_SUBCLASS;
            toolinfo_tooltip.uId      = window.Handle;
            toolinfo_tooltip.lpszText = (IntPtr)(-1); // LPSTR_TEXTCALLBACK

            return(toolinfo_tooltip);
        }
Ejemplo n.º 2
0
        //public void Munge() {
        //    NativeMethods.TOOLINFO tool = new NativeMethods.TOOLINFO();
        //    IntPtr result = NativeMethods.SendMessageTOOLINFO(this.Handle, TTM_GETCURRENTTOOL, 0, tool);
        //    System.Diagnostics.Trace.WriteLine("-");
        //    System.Diagnostics.Trace.WriteLine(result);
        //    result = NativeMethods.SendMessageTOOLINFO(this.Handle, TTM_GETBUBBLESIZE, 0, tool);
        //    System.Diagnostics.Trace.WriteLine(String.Format("{0} {1}", result.ToInt32() >> 16, result.ToInt32() & 0xFFFF));
        //    NativeMethods.ChangeSize(this, result.ToInt32() & 0xFFFF, result.ToInt32() >> 16);
        //    //NativeMethods.RECT r = new NativeMethods.RECT();
        //    //r.right
        //    //IntPtr x = NativeMethods.SendMessageRECT(this.Handle, TTM_ADJUSTRECT, true, ref r);

        //    //System.Diagnostics.Trace.WriteLine(String.Format("{0} {1} {2} {3}", r.left, r.top, r.right, r.bottom));
        //}

        /// <summary>
        /// Remove the given window from those managed by this tooltip
        /// </summary>
        /// <param name="window"></param>
        public void RemoveToolTip(IWin32Window window)
        {
            NativeMethods.TOOLINFO lParam = this.MakeToolInfoStruct(window);
            NativeMethods.SendMessageTOOLINFO(this.Handle, TTM_DELTOOL, 0, lParam);
        }