The problem is not so trivial; please see this overview of this problem and the algorithms of the solution:
http://en.wikipedia.org/wiki/Point_in_polygon[
^].
Also, by apparent reasons, the formulation of this problem itself is somewhat questionable, if the polygon is self-intersecting, which is the usual thing. What is the inner point in this case. One definition could be related to the usual rendering of a polygon use everywhere. It is filled using some color. So, colored areas could be considered as "inner".
Sometimes, I suggest some "idiotic" workarounds, something which will certainly work but ugly or cheating. So, there is a very apparent cheating solution, ugly in its poor performance:
Create a bitmap. Get the instance of
System.Drawing.Graphics
from this bitmap. Render you polygon in this bitmap using
System.Drawing.Graphics.FillPolygon
with some contrast colors. Take your location and check up the color of it using
GetPixel
. If the color is the same as the color of your filling
Brush
, this is the inner point. :-)
Please don't consider this cheating solution too seriously, think about the "real" one described in Wikipedia, as per my first link above. :-)
—SA