I wouldn't expect a compiler error, so a runtime error is what I would expect. Which line is throwing the error? It's not an error message that I have seen before, and I don't see anything that appears wrong, except that the source for the copyFromScreen could do some odd things if you clicked in such a place that the source point had a negative number. That seems unlikely, though.