Exemple #1
0
        public bool IsBoundaryVisable(Rectangle rect)
        {
            bool isVisable;

            if (IsMinimized)
            {
                isVisable = false;
            }
            else
            {
                var pts = new List <System.Drawing.Point>();
                pts.Add(new System.Drawing.Point(rect.Left + 1, rect.Top + 1));
                pts.Add(new System.Drawing.Point(rect.Right - 2, rect.Top + 1));
                pts.Add(new System.Drawing.Point(rect.Left + 1, rect.Bottom - 2));
                pts.Add(new System.Drawing.Point(rect.Right - 2, rect.Bottom - 2));
                for (int i = 0; i < pts.Count; i++)
                {
                    int buyerNameHwnd = WinApi.WindowFromPoint(pts[i]);
                    if (!DescendantHwndInfo.IsDescendantHwnd(buyerNameHwnd, Hwnd.Handle))
                    {
                        isVisable = false;
                        return(isVisable);
                    }
                }
                isVisable = true;
            }
            return(isVisable);
        }
Exemple #2
0
 private void WinEventHooker_EvFocused(object sender, WinEventHooker.WinEventHookEventArgs e)
 {
     if (!IsForeground && DescendantHwndInfo.IsDescendantHwnd(e.Hwnd, Hwnd.Handle))
     {
         IsForeground = true;
     }
 }
Exemple #3
0
        private double GetVisiblePercent()
        {
            var segPts         = GetDeskSegPoints();
            int visiblePtCount = segPts.Count(pt => DescendantHwndInfo.IsDescendantHwnd(WinApi.WindowFromPoint(pt), Hwnd.Handle));

            return((double)visiblePtCount / (double)segPts.Count);
        }
Exemple #4
0
            public static bool IsDescendantHwnd(int buyerNameHwnd, int deskHwnd)
            {
                bool isDescendant = false;;

                if (deskHwnd == 0)
                {
                    return(isDescendant);
                }
                if (GetDescendantHwndFromCache(buyerNameHwnd))
                {
                    isDescendant = (_cache[buyerNameHwnd].RootHwnd == deskHwnd);
                }
                else
                {
                    int rootHwnd = WinApi.GetRootHwnd(buyerNameHwnd);
                    _cache[buyerNameHwnd] = new DescendantHwndInfo(buyerNameHwnd, rootHwnd);
                    isDescendant          = (rootHwnd == deskHwnd);
                }
                return(isDescendant);
            }