Search code examples
asp.netvb.netpolygonimagemap

PolygonHotSpot vs RectangleHotSpot; Can't select all of PolygonHotSpot?


I am programatically creating an ImageMap using VB.NET and then adding PolygonHotSpots to it. It kind of works, but I notice when I hover my mouse over the PolygonHotSpot, there are parts/spots inside that aren't selectable (the mouse cursor changes from the hand to the default cursor).

The coordinates I'm adding to my PolygonHotSpot are (which for this example is simple rectangle):

150,99,270,213,270,99,150,213

I noticed when I change this to a RectangleHotSpot, and set the Top, Bottom, Left, Right based on those same coordinates, it works perfectly, and there aren't any parts inside that aren't selectable. The reason I need to be using PolygonHotSpot rather than RectangleHotSpot is because each hotspot could have more than 4 sides (it will be different every time).

Am I doing something wrong, or should I be checking that if I only have 4 coordinates to go ahead and convert it to a RectangleHotSpot? Or has anyone had any experience with a PolygonHotSpot, maybe I'm missing a setting? I've got the HotSpotMode set to PostBack, etc (everything that worked for the RectangleHotSpot).


Solution

  • You are not drawing a rectangle, but an X. If you put your coordinates in clockwise order IIRC, you will get your rectangle.

    Actually, the clockwise order doesn't seem to matter, but the order does:

    "150,99,270,99,270,213,150,213" should work.