RectangleHotSpot.Left 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이 RectangleHotSpot 개체에서 정의한 사각형 영역 왼쪽의 x 좌표를 가져오거나 설정합니다.
public:
property int Left { int get(); void set(int value); };
public int Left { get; set; }
member this.Left : int with get, set
Public Property Left As Integer
속성 값
이 RectangleHotSpot 개체에서 정의한 사각형 영역 왼쪽의 x 좌표입니다. 기본값은 0입니다.
예제
다음 코드 예제에서는 선언적으로 두 RectangleHotSpot 개체를 포함 하는 컨트롤을 ImageMap 만드는 방법을 보여 줍니다. 하나의 RectangleHotSpot 개체가 선언적으로 만들어지고 속성을 포함한 Left 해당 속성이 선언적으로 설정됩니다. 다른 RectangleHotSpot 개체는 프로그래밍 방식으로 만들어지고 속성을 포함한 Left 해당 속성은 프로그래밍 방식으로 설정됩니다. 이 예제가 제대로 작동하려면 속성에 대한 ImageUrl 고유한 이미지를 제공하고 애플리케이션에서 찾을 수 있도록 이미지의 경로를 적절하게 업데이트해야 합니다.
<%@ 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 Page_Load(object sender, EventArgs e)
{
// Programmatically create a RectangleHotSpot.
RectangleHotSpot Rectangle1 = new RectangleHotSpot();
// Set properties on Rectangle1.
Rectangle1.Top = 0;
Rectangle1.Left = 0;
Rectangle1.Bottom = 200;
Rectangle1.Right = 200;
Rectangle1.PostBackValue = "Yes";
Rectangle1.AlternateText = "Vote yes";
// Add the RectangleHotSpot object to the
// Vote ImageMap control's HotSpotCollection.
Vote.HotSpots.Add(Rectangle1);
}
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>RectangleHotSpot Properties Example</title>
</head>
<body>
<form id="Form1" runat="server">
<h3>RectangleHotSpot Properties Example</h3>
<!-- Change or remove the width and height attributes as
appropriate for your image. -->
<asp:imagemap id="Vote"
imageurl="Images/VoteImage.jpg"
alternatetext="Voting choices"
hotspotmode="PostBack"
width="400"
height="200"
onclick="VoteMap_Clicked"
runat="Server">
<asp:RectangleHotSpot
top="0"
left="201"
bottom="200"
right="400"
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 Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Programmatically create a RectangleHotSpot.
Dim Rectangle1 As New RectangleHotSpot
' Set properties on Rectangle1.
Rectangle1.Top = 0
Rectangle1.Left = 0
Rectangle1.Bottom = 200
Rectangle1.Right = 200
Rectangle1.PostBackValue = "Yes"
Rectangle1.AlternateText = "Vote yes"
' Add the RectangleHotSpot object to the
' Vote ImageMap control's HotSpotCollection.
Vote.HotSpots.Add(Rectangle1)
End Sub
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>RectangleHotSpot Properties Example</title>
</head>
<body>
<form id="Form1" runat="server">
<h3>RectangleHotSpot Properties Example</h3>
<!-- Change or remove the width and height attributes as
appropriate for your image. -->
<asp:imagemap id="Vote"
imageurl="Images/VoteImage.jpg"
alternatetext="Voting choices"
hotspotmode="PostBack"
width="400"
height="200"
onclick="VoteMap_Clicked"
runat="Server">
<asp:RectangleHotSpot
top="0"
left="201"
bottom="200"
right="400"
postbackvalue="No"
alternatetext="Vote no">
</asp:RectangleHotSpot>
</asp:imagemap>
<br />
<asp:label id="Message1"
runat="Server">
</asp:label>
</form>
</body>
</html>
설명
이 속성을 사용하면 이 LeftRectangleHotSpot 개체에서 정의한 사각형 영역 왼쪽의 x 좌표를 나타내는 값을 얻거나 설정할 수 있습니다. 개체를 RectangleHotSpot 완전히 정의하려면 이 속성과 , Right및 Bottom 속성에 Top대한 값을 지정해야 합니다.