HotSpotMode Enumeração
Definição
public enum class HotSpotMode
public enum HotSpotMode
type HotSpotMode =
Public Enum HotSpotMode
- Herança
Campos
| Inactive | 3 | O HotSpot não tem nenhum comportamento.The HotSpot does not have any behavior. |
| Navigate | 1 | O HotSpot navega para uma URL.The HotSpot navigates to a URL. |
| NotSet | 0 | O HotSpot usa o comportamento definido pelo controle ImageMap, propriedade HotSpotMode.The HotSpot uses the behavior set by the ImageMap control's HotSpotMode property. Se o controle ImageMap não definir o comportamento, o objeto HotSpot navegará para uma URL.If the ImageMap control does not define the behavior, the HotSpot object navigates to a URL. |
| PostBack | 2 | O HotSpot gera um postback para o servidor.The HotSpot generates a postback to the server. |
Exemplos
O exemplo de código a seguir demonstra como usar os HotSpotMode valores de enumeração para definir a ImageMap.HotSpotMode propriedade.The following code example demonstrates how to use the HotSpotMode enumeration values to set the ImageMap.HotSpotMode property. A página contém um ImageMap controle que contém dois RectangleHotSpot objetos.The page contains an ImageMap control that contains two RectangleHotSpot objects. A ImageMap.HotSpotMode propriedade é definida como HotSpotMode.PostBack , o que faz com que a página seja reposta ao servidor sempre que um usuário clicar em uma das regiões de ponto de acesso.The ImageMap.HotSpotMode property is set to HotSpotMode.PostBack, which causes the page to post back to the server each time a user clicks one of the hot spot regions. A HotSpotMode propriedade não está definida em nenhum dos RectangleHotSpot objetos porque elas obtêm o comportamento da ImageMap.HotSpotMode propriedade.The HotSpotMode property is not set on either of the RectangleHotSpot objects because they get their behavior from the ImageMap.HotSpotMode property. Para que este exemplo funcione corretamente, você deve fornecer sua própria imagem para a ImageUrl propriedade e atualizar o caminho para a imagem de forma adequada para que o aplicativo possa localizá-la.For this example to work correctly, you must supply your own image for the ImageUrl property and update the path to the image appropriately so that the application can locate it.
<%@ page language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void VoteMap_Clicked(object sender, ImageMapEventArgs e)
{
// When a user clicks the "Yes" hot spot,
// display the hot spot's value.
if (e.PostBackValue == "Yes")
Message1.Text = "You selected " + e.PostBackValue + ".";
else if (e.PostBackValue == "No")
// When a user clicks the "No" hot spot,
// display the hot spot's value.
Message1.Text = "You selected " + e.PostBackValue + ".";
else
Message1.Text = "You did not click a valid hot spot region.";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="head1" runat="server">
<title>ImageMap.HotSpotMode Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>ImageMap.HotSpotMode Example</h3>
<!--The RectangleHotSpot objects have the post back
behavior specified by the HotSpotMode
property on the ImageMap control.-->
<asp:imagemap id="Vote"
imageurl="Images/VoteImage.jpg"
alternatetext="Voting choices"
hotspotmode="PostBack"
onclick="VoteMap_Clicked"
runat="Server">
<asp:RectangleHotSpot
top="0"
left="0"
bottom="354"
right="250"
postbackvalue="Yes"
alternatetext="Vote yes">
</asp:RectangleHotSpot>
<asp:RectangleHotSpot
top="0"
left="251"
bottom="354"
right="500"
postbackvalue="No"
alternatetext="Vote no">
</asp:RectangleHotSpot>
</asp:imagemap>
<br />
<asp:label id="Message1"
runat="Server">
</asp:label>
</form>
</body>
</html>
<%@ page language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub VoteMap_Clicked(ByVal sender As Object, ByVal e As ImageMapEventArgs)
' When a user clicks the "Yes" hot spot,
' display the hot spot's value.
If (e.PostBackValue = "Yes") Then
Message1.Text = "You selected " & e.PostBackValue & "."
' When a user clicks the "No" hot spot,
' display the hot spot's value.
ElseIf (e.PostBackValue = "No") Then
Message1.Text = "You selected " & e.PostBackValue & "."
Else
Message1.Text = "You did not click a valid hot spot region."
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="head1" runat="server">
<title>ImageMap.HotSpotMode Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>ImageMap.HotSpotMode Example</h3>
<!--The RectangleHotSpot objects have the post back
behavior specified by the HotSpotMode
property on the ImageMap control.-->
<asp:imagemap id="Vote"
imageurl="Images/VoteImage.jpg"
alternatetext="Voting choices"
hotspotmode="PostBack"
onclick="VoteMap_Clicked"
runat="Server">
<asp:RectangleHotSpot
top="0"
left="0"
bottom="354"
right="250"
postbackvalue="Yes"
alternatetext="Vote yes">
</asp:RectangleHotSpot>
<asp:RectangleHotSpot
top="0"
left="251"
bottom="354"
right="500"
postbackvalue="No"
alternatetext="Vote no">
</asp:RectangleHotSpot>
</asp:imagemap>
<br />
<asp:label id="Message1"
runat="Server">
</asp:label>
</form>
</body>
</html>
Comentários
A HotSpotMode enumeração representa os comportamentos que você pode aplicar a um HotSpot objeto dentro de um ImageMap controle.The HotSpotMode enumeration represents the behaviors that you can apply to a HotSpot object within an ImageMap control. O ImageMap.HotSpotMode e as HotSpot.HotSpotMode Propriedades usam esses valores de enumeração para definir o comportamento de um HotSpot objeto quando ele é clicado.The ImageMap.HotSpotMode and the HotSpot.HotSpotMode properties use these enumeration values to set the behavior of a HotSpot object when it is clicked. Se ambas as propriedades forem definidas, a HotSpot.HotSpotMode propriedade especificada em cada HotSpot objeto individual terá precedência sobre a ImageMap.HotSpotMode propriedade no controle.If both properties are set, the HotSpot.HotSpotMode property specified on each individual HotSpot object takes precedence over the ImageMap.HotSpotMode property on the control.
Se você especificar HotSpotMode.NotSet para a HotSpot.HotSpotMode propriedade de um HotSpot objeto individual, o obterá HotSpot seu comportamento da ImageMap Propriedade do controle que o contém ImageMap.HotSpotMode .If you specify HotSpotMode.NotSet for the HotSpot.HotSpotMode property of an individual HotSpot object, the HotSpot gets its behavior from the containing ImageMap control's ImageMap.HotSpotMode property. Nesse cenário, se a ImageMap Propriedade do controle HotSpotMode for NotSet ou nenhum valor for especificado, o comportamento padrão será navegar para uma URL.In this scenario, if the ImageMap control's HotSpotMode property is either NotSet or no value is specified, the default behavior is to navigate to a URL.
Observação
Se ImageMap o comportamento de um controle não for especificado usando a ImageMap.HotSpotMode propriedade ou a HotSpot.HotSpotMode Propriedade nos HotSpot objetos que ele contém, por padrão o comportamento será HotSpotMode.Navigate .If an ImageMap control's behavior is not specified using either the ImageMap.HotSpotMode property or the HotSpot.HotSpotMode property on the HotSpot objects it contains, by default the behavior is HotSpotMode.Navigate. Além disso, se as HotSpot.HotSpotMode Propriedades nos HotSpot objetos que um ImageMap controle contém estiverem definidas como HotSpotMode.NotSet e nenhum valor for especificado para a ImageMap.HotSpotMode propriedade, o comportamento padrão será HotSpotMode.Navigate .In addition, if the HotSpot.HotSpotMode properties on the HotSpot objects that an ImageMap control contains are set to HotSpotMode.NotSet and no value is specified for the ImageMap.HotSpotMode property, the default behavior is HotSpotMode.Navigate.
Se você especificar HotSpotMode.Navigate para a ImageMap.HotSpotMode propriedade ou a HotSpot.HotSpotMode propriedade, a página navegará para uma URL quando o HotSpot for clicado.If you specify HotSpotMode.Navigate for either the ImageMap.HotSpotMode property or the HotSpot.HotSpotMode property, the page navigates to a URL when the HotSpot is clicked. Use a Image.NavigateUrl propriedade ou HotSpot.NavigateUrl para especificar a URL para a qual navegar.Use the Image.NavigateUrl or the HotSpot.NavigateUrl property to specify the URL to navigate to.
Se você especificar HotSpotMode.PostBack para a ImageMap.HotSpotMode propriedade ou a HotSpot.HotSpotMode propriedade, a página gerará um postback para o servidor quando o HotSpot for clicado.If you specify HotSpotMode.PostBack for either the ImageMap.HotSpotMode property or the HotSpot.HotSpotMode property, the page generates a postback to the server when the HotSpot is clicked. Use a PostBackValue propriedade para especificar um nome para o HotSpot objeto.Use the PostBackValue property to specify a name for the HotSpot object. Esse nome será passado nos dados do ImageMapEventArgs evento quando o evento de postback ocorrer.This name will be passed in the ImageMapEventArgs event data when the postback event occurs. Quando um postback HotSpot é clicado, o Click evento é gerado.When a postback HotSpot is clicked, the Click event is raised. Para controlar programaticamente as ações executadas quando um postback HotSpot é clicado, forneça um manipulador de eventos para o Click evento.To programmatically control the actions performed when a postback HotSpot is clicked, provide an event handler for the Click event.
Se você especificar HotSpotMode.Inactive para a HotSpot.HotSpotMode propriedade, o HotSpot objeto não terá nenhum comportamento quando for clicado.If you specify HotSpotMode.Inactive for the HotSpot.HotSpotMode property, the HotSpot object does not have any behavior when it is clicked. Você pode usar esse valor para criar um ponto de acesso inativo em um ponto de acesso ativo maior.You can use this value to create an inactive hot spot within a larger active hot spot. Essa opção é fornecida para permitir que você crie zonas de ponto de acesso mais complexas dentro de um ImageMap controle.This option is provided to allow you to create more complex hot spot zones within an ImageMap control.
Para criar uma área inativa em um ponto de acesso ativo, você deve especificar o ponto de acesso inativo antes do ativo no ImageMap controle.To create an inactive area within an active hot spot, you must specify the inactive hot spot before the active one in the ImageMap control. Por exemplo, o seguinte ImageMap define um anel ativo especificando um ponto de acesso circular inativo em um ponto de acesso circular ativo maior:For example, the following ImageMap defines an active ring by specifying an inactive circular hot spot within a larger active circular hot spot:
<asp:ImageMap ID="SaturnImage"
ImageUrl="~/saturn.PNG"
runat="server" OnClick="SaturnImage_Click">
<asp:CircleHotSpot AlternateText="planet" HotSpotMode=PostBack
PostBackValue="planet" Radius=40 X=100 Y=100 />
<asp:CircleHotSpot HotSpotMode=Inactive
Radius=60 X=100 Y=100 />
<asp:CircleHotSpot AlternateText="rings" HotSpotMode=PostBack
PostBackValue="rings" Radius=80 X=100 Y=100 />
</asp:ImageMap>