Monday, March 12, 2007

New article on CodeProject .NET

http://www.codeproject.com/useritems/HtmlMap.asp

2 comments:

Ben said...

Great articale, I am trying to use it with an array, but it complains regarding the Area[0].Shape = AreaShapesEnum.POLY;

Says that the AreaShapesEnum should be New

See full code below, any help would be great?

HtmlMap CountyMap = new HtmlMap();
CountyMap.NAME = "CountyMap";

MapArea[] Area = new MapArea[3];

Area[0].Shape = AreaShapesEnum.POLY;
Area[0].Href = new Uri("http://leaveit2007/suffolk.aspx");
Area[0].Coords = new List< int >(new int[] {
255, 208, 216, 196, 217, 224, 210, 246, 228, 256, 253,
267, 265, 271, 272, 261, 280, 243, 297, 222, 297, 207, 299, 191, 302, 179, 277, 189 });


Area[0].Attributes.Add("onmouseover",
"javascript:ddrivetip('something', '#EFEFEF');");

Area[0].Attributes.Add("onmouseout",
"javascript:hideddrivetip();");

CountyMap.AREAS.Add(Area[0]);

return CountyMap;

$HiC0 said...

Thank you, Ben. I looked through your code and understand your mistake. Of couse vefore you'll use some object you need to create it. So, just add folloeing code before assign something to Area[i] fields:

for (int i = 0; i < 3; i++)
{
Area[i] = new MapArea();
}