예제 #1
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="window">The parent window for the tool tip window</param>
        internal NativeToolTipWindow(IWin32Window window)
        {
            // Determine the correct messages to use
            if (Marshal.SystemDefaultCharSize == 1)
            {
                // Win9x
                TTM_ADDTOOL       = TTM_ADDTOOLA;
                TTM_UPDATETIPTEXT = TTM_UPDATETIPTEXTA;
            }
            else
            {
                // NT/XP
                TTM_ADDTOOL       = TTM_ADDTOOLW;
                TTM_UPDATETIPTEXT = TTM_UPDATETIPTEXTW;
            }

            owner = window;

            CreateParams cp = new CreateParams();

            cp.Parent    = owner.Handle;
            cp.ClassName = TOOLTIP_CLASS;
            cp.Style     = TTS_ALWAYSTIP | TTS_NOPREFIX;

            this.CreateHandle(cp);

            // Make the window topmost
            UnsafeNativeMethods.SetWindowPos(this.Handle, new IntPtr(-1), 0, 0, 0, 0,
                                             19 /*SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE*/);

            ti = new TOOLINFO(TTF_IDISHWND | TTF_TRACK | TTF_ABSOLUTE, owner.Handle);
            UnsafeNativeMethods.SendMessage(this.Handle, TTM_ADDTOOL, IntPtr.Zero, ref ti);

            // All subsequent uses just need this flag
            ti.flags = TTF_IDISHWND;
        }
 internal static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, ref TOOLINFO lParam);
예제 #3
0
 internal static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, ref TOOLINFO lParam);
        //=====================================================================
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="window">The parent window for the tool tip window</param>
        internal NativeToolTipWindow(IWin32Window window)
        {
            // Determine the correct messages to use
            if(Marshal.SystemDefaultCharSize == 1)
            {
                // Win9x
                TTM_ADDTOOL = TTM_ADDTOOLA;
                TTM_UPDATETIPTEXT = TTM_UPDATETIPTEXTA;
            }
            else
            {
                // NT/XP
                TTM_ADDTOOL = TTM_ADDTOOLW;
                TTM_UPDATETIPTEXT = TTM_UPDATETIPTEXTW;
            }

            owner = window;

            CreateParams cp = new CreateParams();
            cp.Parent = owner.Handle;
            cp.ClassName = TOOLTIP_CLASS;
            cp.Style = TTS_ALWAYSTIP | TTS_NOPREFIX;

            this.CreateHandle(cp);

            // Make the window topmost
            UnsafeNativeMethods.SetWindowPos(this.Handle, new IntPtr(-1), 0, 0, 0, 0,
                19 /*SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE*/);

            ti = new TOOLINFO(TTF_IDISHWND | TTF_TRACK | TTF_ABSOLUTE, owner.Handle);
            UnsafeNativeMethods.SendMessage(this.Handle, TTM_ADDTOOL, IntPtr.Zero, ref ti);

            // All subsequent uses just need this flag
            ti.flags = TTF_IDISHWND;
        }