Exemplo n.º 1
0
        //// use WS_EX_COMPOSITED to avoid flickering e.g. at splitter drag
        //private static void SetFormLevelDoubleBuffering( ScrollableControl control, bool enable )
        //{
        //	// stop scrollbar animation to avoid glitch.
        //	if( enable && ( control.HorizontalScroll.Visible || control.VerticalScroll.Visible ) )
        //	{
        //		// https://stackoverflow.com/questions/562029/stopping-scroll-bar-fade-in-vista-net-or-winapi
        //		if( PI.IsThemeActive() )
        //			PI.SetWindowTheme( control.Handle, null, null );
        //	}

        //	//// Activate double buffering at the form level.  All child controls will be double buffered as well.

        //	//int windowStyle = PI.GetWindowLong( control.Handle, PI.GWL_EXSTYLE );
        //	//if( enable )
        //	//	PI.SetWindowLong( control.Handle, PI.GWL_EXSTYLE, (IntPtr)( windowStyle | PI.WS_EX_COMPOSITED ) );
        //	//else
        //	//	PI.SetWindowLong( control.Handle, PI.GWL_EXSTYLE, (IntPtr)( windowStyle & ~PI.WS_EX_COMPOSITED ) );
        //}

        private bool IsDropDownListAtPoint(Point pos)
        {
            IntPtr hWnd = PI.WindowFromPoint(new PI.POINT(pos));

            if (hWnd != IntPtr.Zero)
            {
                string className = PI.GetClassName(hWnd);
                if (className == "ComboLBox")
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Should a mouse down at the provided point cause an end to popup tracking.
        /// </summary>
        /// <param name="m">Original message.</param>
        /// <param name="pt">Client coordinates point.</param>
        /// <returns>True to end tracking; otherwise false.</returns>
        public virtual bool DoesCurrentMouseDownEndAllTracking(Message m, Point pt)
        {
            bool endTracking = !ClientRectangle.Contains(pt);

            // The mouse is not over our client area but the focus is
            if (endTracking && ContainsFocus)
            {
                // Get the window handle of the window under this screen point
                Point    screenPt   = PointToScreen(pt);
                PI.POINT screenPIPt = new PI.POINT
                {
                    X = screenPt.X,
                    Y = screenPt.Y
                };
                IntPtr hWnd = PI.WindowFromPoint(screenPIPt);

                // Assuming we got back a valid window handle
                if (hWnd != IntPtr.Zero)
                {
                    StringBuilder className = new StringBuilder(256);
                    int           length    = PI.GetClassName(hWnd, className, className.Capacity);

                    // If we got back a valid name
                    if (length > 0)
                    {
                        // If let the message occur as it is being pressed on a combo box
                        // drop down list and so it will process the message appropriately
                        if (className.ToString() == "ComboLBox")
                        {
                            endTracking = false;
                        }
                    }
                }
            }

            return(endTracking);
        }