Example #1
0
        /// <summary>
        /// 查找指定区域内的颜色块,颜色格式"RRGGBB-DRDGDB",注意,和按键的颜色格式相反
        /// </summary>
        /// <param name="dmsoft"></param>
        /// <param name="findColor"></param>
        /// <returns>指向颜色块的左上角</returns>
        public static Point FindColorBlock(this dmsoft dmsoft, FindColorBlock findColor)
        {
            int x, y;
            int ret = dmsoft.FindColorBlock(findColor.X1, findColor.Y1, findColor.X2, findColor.Y2, findColor.Color, findColor.Sim, findColor.Count, findColor.Width, findColor.Height, out x, out y);

            if (ret == 0)
            {
                return(new Point());
            }
            else
            {
                return(new Point(x, y));
            }
        }
Example #2
0
        /// <summary>
        /// 查找指定区域内的所有颜色块,颜色格式"RRGGBB-DRDGDB",注意,和按键的颜色格式相反
        /// </summary>
        /// <param name="dmsoft"></param>
        /// <param name="findColor"></param>
        /// <returns>查找指定区域内的所有颜色块,颜色格式"RRGGBB-DRDGDB",注意,和按键的颜色格式相反</returns>
        public static List <Point> FindColorBlockEx(this dmsoft dmsoft, FindColorBlock findColor)
        {
            int          x, y;
            List <Point> points = new List <Point>();
            string       s      = dmsoft.FindColorBlockEx(findColor.X1, findColor.Y1, findColor.X2, findColor.Y2, findColor.Color, findColor.Sim, findColor.Count, findColor.Width, findColor.Height);

            var index = 0;
            var count = dmsoft.GetResultCount(s);

            while (index < count)
            {
                dmsoft.GetResultPos(s, index++, out x, out y);
                points.Add(new Point(x, y));
            }
            return(points);
        }