How to HitTest a polygonal region

Bool HitTest(PointF[] polygonCorners, PointF mousePosition) { GraphicsPath path = new GraphicsPath(); path.AddLines(polygonCorners); Region region = new Region(path); // Hittest the region to verify if the point is in the rect if(region.IsVisible(mousePosition)) return true; else return false; }

How to convert an application project to class library project, and vice versa

In the Solutions Explorer window, right-click the exe project and then select Properties in the popup. Then change the Output type from Windows Application to Class Library. You may also want to comment out the Main method in your code as it is not needed in the library project. To convert from a DLL to and exe, reverse the process.