Using ImageMap and displaying circles on it

Discussion in 'ASP .Net' started by Gilgamesh, Jan 6, 2006.

  1. Gilgamesh

    Gilgamesh Guest

    Hi,

    I have some very limited knowledge of web development but I have an
    imagemap in which I want to be able to display a small yellow circle at
    certain pre-define locations. When the user moves over these circles, I
    need to show a small pop-up with info regarding this label.
    Here is my Page_Load method:


    // These create the hotspots at predefined locations which I'll get
    from the database
    imageMap.Areas.Add(new ImageMapCircleArea("", new Point(100, 50), 12));
    imageMap.Areas.Add(new ImageMapCircleArea(null, new Point(139, 50), 41,
    "XXXXXXXXXX"));

    imageMap.Areas.Add(new ImageMapCircleArea("", new Point(200, 150),
    12));
    imageMap.Areas.Add(new ImageMapCircleArea(null, new Point(200, 150),
    41, "YYYYYYYYYY"));

    imageMap.Areas.Add(new ImageMapCircleArea("", new Point(300, 250),
    12));
    imageMap.Areas.Add(new ImageMapCircleArea(null, new Point(300, 250),
    41, "ZZZZZZZZZZ"));

    imageMap.Areas.Add(new ImageMapCircleArea("", new Point(400, 250),
    12));
    imageMap.Areas.Add(new ImageMapCircleArea(null, new Point(400, 250),
    41, "AAAAAAAAAA"));

    imageMap.Areas.Add(new ImageMapCircleArea("", new Point(500, 250),
    12));
    imageMap.Areas.Add(new ImageMapCircleArea(null, new Point(500, 250),
    41, "BBBBBBBBBBB"));

    //
    // HOW DO I ADD CIRCLES TO THE IMAGEMAP AT THIS POINT TO REPRESENT
    // EACH OF THE ABOVE POINTS
    //

    // add the script called by the event handlers
    StringBuilder script = new StringBuilder();
    script.AppendFormat("<script language=\"javascript\">{0}",
    Environment.NewLine);
    script.AppendFormat("\tvar image1 = new Image(291, 112);{0}",
    Environment.NewLine);
    script.AppendFormat("\timage1.src = \"Bham Backdrop.JPG\";{0}",
    Environment.NewLine);
    script.AppendFormat("\tfunction DisplayImage(image) {0}{1}", "{",
    Environment.NewLine);
    script.AppendFormat("\t\tdocument.imageMap.src = image.src;{0}",
    Environment.NewLine);
    script.AppendFormat("\t\treturn true;{0}", Environment.NewLine);
    script.AppendFormat("\t{0}{1}", "}", Environment.NewLine);
    script.Append("</script>");

    Page.RegisterClientScriptBlock("DisplayImage", script.ToString());
     
    Gilgamesh, Jan 6, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Shohet
    Replies:
    3
    Views:
    375
    John Saunders
    Aug 28, 2003
  2. henryh
    Replies:
    1
    Views:
    930
    Roedy Green
    Sep 18, 2005
  3. Replies:
    0
    Views:
    1,113
  4. Douglas Douglas

    Identifying filled circles in a scanned image

    Douglas Douglas, Mar 31, 2006, in forum: Python
    Replies:
    3
    Views:
    301
    Paul McGuire
    Mar 31, 2006
  5. shawn bright

    rmagick and circles

    shawn bright, Nov 29, 2008, in forum: Ruby
    Replies:
    4
    Views:
    137
    Oliver Burghard
    Nov 30, 2008
Loading...

Share This Page