Click here to Skip to main content
16,018,347 members
Home / Discussions / C#
   

C#

 
QuestionTextBox disabling Middle-Scroll. Pin
Baeltazor31-Jul-09 6:58
Baeltazor31-Jul-09 6:58 
AnswerRe: TextBox disabling Middle-Scroll. Pin
Xmen Real 31-Jul-09 7:01
professional Xmen Real 31-Jul-09 7:01 
GeneralRe: TextBox disabling Middle-Scroll. Pin
Baeltazor31-Jul-09 7:07
Baeltazor31-Jul-09 7:07 
GeneralRe: TextBox disabling Middle-Scroll. Pin
Xmen Real 31-Jul-09 7:09
professional Xmen Real 31-Jul-09 7:09 
GeneralRe: TextBox disabling Middle-Scroll. Pin
Baeltazor31-Jul-09 7:10
Baeltazor31-Jul-09 7:10 
GeneralRe: TextBox disabling Middle-Scroll. Pin
Xmen Real 31-Jul-09 7:16
professional Xmen Real 31-Jul-09 7:16 
GeneralRe: TextBox disabling Middle-Scroll. Pin
Baeltazor31-Jul-09 7:21
Baeltazor31-Jul-09 7:21 
QuestionYDreams ImageMapDemo 2.0 Code Behind Issue Pin
dmgroup198431-Jul-09 6:47
dmgroup198431-Jul-09 6:47 
Hello

I have an ImageMap created using YDreams ImageMapDemo 2.0. I'm using this control for the rollover image effect with circle and polygons hotspots. My issue is I can't seem to figure out how to write the correct C# code for each hotspot. I am able to get one hotspot to have the rollover effect but not the other 4. Can someone please help me out with the code behind. I am very very new with C+. Anyone's help would be much appreciated. Been banging my head for 2 months.

Thanks in advanced

Dale

Form code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<%@ Register Assembly="YDreams.Web.UI.WebControls" Namespace="YDreams.Web.UI.WebControls"
    TagPrefix="ydreams" %>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
    
      function pageLoad() {
      }
    
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
    </div>
    <div>
        <ydreams:ImageMap ID="ImageMap1" ImageUrl="methodology_circle_green.gif" OnClick="ImageMap1_Click" runat="server">
            <ydreams:CircleHotSpot CenterX="210" CenterY="45" Description="Click to test post back..."
                HotSpotMode="Navigate" Radius="41" ToolTip="Post back" Id="AssessCircle" />
            <ydreams:CircleHotSpot CenterX="310" CenterY="120" Description="Click to test post back..."
                HotSpotMode="Navigate" Radius="41" ToolTip="Post back" Id="AnalyzeCircle" />
            <ydreams:CircleHotSpot CenterX="270" CenterY="240" Description="Click to test post back..."
                HotSpotMode="Navigate" Radius="41" ToolTip="Post back" Id="ArchitectCircle" />
            <ydreams:CircleHotSpot CenterX="145" CenterY="240" Description="Click to test post back..."
                HotSpotMode="Navigate" Radius="41" ToolTip="Post back" Id="AssembleCircle" />
            <ydreams:CircleHotSpot CenterX="103" CenterY="120" Description="Click to test post back..."
                HotSpotMode="Navigate" Radius="41" ToolTip="Post back" Id="AssimilateCircle" />
        </ydreams:ImageMap>
        <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
    </div>
    </form>
</body>
</html>


Code Behind

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        YDreams.Web.UI.WebControls.HotSpot AssessCircle = new YDreams.Web.UI.WebControls.CircleHotSpot(210, 45, 41);
        {
            ImageMap1.HotSpots.Add(AssessCircle);
            {
                // add OnMouseOver and OnMouseOut event handlers to the blue polygon hot spot
                YDreams.Web.UI.WebControls.CircleHotSpot circleHotSpot = (YDreams.Web.UI.WebControls.CircleHotSpot)this.ImageMap1.HotSpots["AssessCircle"];
                if (circleHotSpot != null)
                {
                    circleHotSpot.Attributes.Add("onMouseOver", "javascript:DisplayImage(image2);");
                    circleHotSpot.Attributes.Add("onMouseOut", "javascript:DisplayImage(image1);");
                }

                // add the script called by the event handlers
                string script = @"
                    var image1 = new Image(413, 285);
                    image1.src = 'methodology_circle_green.gif';
                    var image2 = new Image(413, 285);
                    image2.src = 'methodology_circle_blue_assess.gif';

                    function DisplayImage(image) {
	                    var theImage = document.images['ImageMap1'];
	                    if (!theImage) {
	                        theImage = document.getElementById('ImageMap1');	
	                    }
                        theImage.src = image.src;
                        return true;
                    }
                ";

                this.ClientScript.RegisterClientScriptBlock(this.GetType(), "DisplayImage", script, true);
            }
        }
        
        YDreams.Web.UI.WebControls.HotSpot AnalyzeCircle = new YDreams.Web.UI.WebControls.CircleHotSpot(310, 120, 41);
        {
            ImageMap1.HotSpots.Add(AnalyzeCircle);
            {
                // add OnMouseOver and OnMouseOut event handlers to the blue polygon hot spot
                YDreams.Web.UI.WebControls.CircleHotSpot circleHotSpot = (YDreams.Web.UI.WebControls.CircleHotSpot)this.ImageMap1.HotSpots["AnalyzeCircle"];
                if (circleHotSpot != null)
                {
                    circleHotSpot.Attributes.Add("onMouseOver", "javascript:DisplayImage(image2);");
                    circleHotSpot.Attributes.Add("onMouseOut", "javascript:DisplayImage(image1);");
                }

                // add the script called by the event handlers
                string script = @"
                    var image1 = new Image(413, 285);
                    image1.src = 'methodology_circle_green.gif';
                    var image2 = new Image(413, 285);
                    image2.src = 'methodology_circle_blue_analyze.gif';

                    function DisplayImage(image) {
	                    var theImage = document.images['ImageMap1'];
	                    if (!theImage) {
	                        theImage = document.getElementById('ImageMap1');	
	                    }
                        theImage.src = image.src;
                        return true;
                    }
                ";

                this.ClientScript.RegisterClientScriptBlock(this.GetType(), "DisplayImage", script, true);
            }
        }
    }
    protected void ImageMap1_Click(object sender, YDreams.Web.UI.WebControls.ImageMapClickEventArgs args)
    {
        YDreams.Web.UI.WebControls.HotSpot hotSpot = args.HotSpot;
        int x = args.X;
        int y = args.Y;

        // set the text of the label
        this.Label1.Text = string.Format("Clicked on hot spot \"{0}\" at image coordinates ({1}, {2})", hotSpot.Id, x, y);
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        this.Label1.Text = string.Empty;
    }

}

AnswerRe: YDreams ImageMapDemo 2.0 Code Behind Issue Pin
Henry Minute31-Jul-09 9:28
Henry Minute31-Jul-09 9:28 
GeneralRe: YDreams ImageMapDemo 2.0 Code Behind Issue Pin
dmgroup198431-Jul-09 11:38
dmgroup198431-Jul-09 11:38 
QuestionChanging the text colour (foreColor) of a DateTimePicker? Pin
MWRivera31-Jul-09 6:44
MWRivera31-Jul-09 6:44 
QuestionRe: Changing the text colour (foreColor) of a DateTimePicker? Pin
Ruben Herman27-Aug-10 23:24
Ruben Herman27-Aug-10 23:24 
QuestionChanging the colour of the inside of a checkbox? Pin
MWRivera31-Jul-09 6:34
MWRivera31-Jul-09 6:34 
AnswerRe: Changing the colour of the inside of a checkbox? Pin
Xmen Real 31-Jul-09 6:53
professional Xmen Real 31-Jul-09 6:53 
GeneralRe: Changing the colour of the inside of a checkbox? Pin
MWRivera31-Jul-09 8:04
MWRivera31-Jul-09 8:04 
GeneralRe: Changing the colour of the inside of a checkbox? Pin
Xmen Real 31-Jul-09 8:21
professional Xmen Real 31-Jul-09 8:21 
GeneralRe: Changing the colour of the inside of a checkbox? Pin
MWRivera31-Jul-09 8:23
MWRivera31-Jul-09 8:23 
AnswerRe: Changing the colour of the inside of a checkbox? Pin
Baeltazor31-Jul-09 7:25
Baeltazor31-Jul-09 7:25 
GeneralRe: Changing the colour of the inside of a checkbox? Pin
MWRivera31-Jul-09 8:00
MWRivera31-Jul-09 8:00 
GeneralRe: Changing the colour of the inside of a checkbox? Pin
Baeltazor31-Jul-09 15:36
Baeltazor31-Jul-09 15:36 
GeneralRe: Changing the colour of the inside of a checkbox? Pin
MWRivera4-Aug-09 5:16
MWRivera4-Aug-09 5:16 
GeneralRe: Changing the colour of the inside of a checkbox? Pin
MWRivera4-Aug-09 6:46
MWRivera4-Aug-09 6:46 
AnswerRe: Changing the colour of the inside of a checkbox? Pin
Henry Minute31-Jul-09 9:35
Henry Minute31-Jul-09 9:35 
GeneralRe: Changing the colour of the inside of a checkbox? Pin
MWRivera31-Jul-09 10:25
MWRivera31-Jul-09 10:25 
QuestionSystem tray refresh? Pin
mark_me31-Jul-09 6:30
mark_me31-Jul-09 6:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.