此bugger不起作用,我什至无法检查出什么毛病,因为它无法达到断点。 如果在“ Console.WriteLine(“从未到达断点”);“处设置断点,它不会触发中断。 这是简单的代码,但我不知道为什么它不起作用。可能需要更多的睡眠:) ThisPixelCheck函数,如果在某个点找到颜色,则返回true或false。看起来好像没有到达代码。
void FindPixel()
{
int x = 455;
int y = 1109;
int found = 0;
Color findcolor = ColorTranslator.FromHtml("#FFFFFF");
for (int yplus = 0; yplus > 50; yplus++)
{
for (int xplus = 0; xplus > 50; xplus++)
{
Console.WriteLine("breakpoint is never reached");
var point = new Point(x + xplus, y + yplus);
var foundpixel = ThisPixelCheck(point, findcolor);
if (foundpixel)
{
found += 1;
}
}
status_Label.Text = found.ToString() + " pixels found.";
}
}
答案 0 :(得分:1)
void FindPixel()
{
int x = 455;
int y = 1109;
int found = 0;
Color findcolor = ColorTranslator.FromHtml("#FFFFFF");
for (int yplus = 0; yplus < 50; yplus++)
{
for (int xplus = 0; xplus < 50; xplus++)
{
Console.WriteLine("breakpoint is never reached");
var point = new Point(x + xplus, y + yplus);
var foundpixel = ThisPixelCheck(point, findcolor);
if (foundpixel)
{
found += 1;
}
}
status_Label.Text = found.ToString() + " pixels found.";
}
}
for
循环是错误的。
答案 1 :(得分:0)
for (int yplus = 0; yplus > 50; yplus++)
此行yplus为零且小于50,因此Programm永远不会进入循环。 您应该尝试yplus <50