コード例 #1
0
        /// -------------------------------------------------------------------
        /// <summary>
        /// After you get the array and mask everything out, look through the 
        /// array for any points that are clickable.
        /// </summary>
        /// -------------------------------------------------------------------
        void TS_FindFirstClickablePoint(AutomationElement element, ref Drawing.Bitmap bm, ref Point pt)
        {
            pt = new Point(double.NaN, double.NaN);
            for (int y = 0; y < bm.Height; y++)
            {
                for (int x = 0; x < bm.Width; x++)
                {
                    if (!bm.GetPixel(x, y).Equals(m_maskColor))
                    {
                        pt.X = x;
                        pt.Y = y;

                        Point ptOffset = pt;

                        ptOffset.Offset(element.Current.BoundingRectangle.X, element.Current.BoundingRectangle.Y);
                        Comment("Found clickable point at relative point(" + pt + ") which is absolute point(" + ptOffset + ")");
                        m_TestStep++;
                        return;
                    }
                }
            }
            Comment("Could not find clickable point");
            m_TestStep++;
        }