页面上添加显示放大镜的按钮:
<esri:Command ClientAction="toggleMagnifier();" DefaultImage="Images/MapTool/show-magnify-win_OFF.png"
HoverImage="Images/MapTool/show-magnify-win_ON.png" JavaScriptFile="" Name="放大镜"
SelectedImage="Images/MapTool/show-magnify-win_ON.png" ToolTip="放大镜" />
放大镜工具:
<esri:Magnifier ID="Magnifier1" runat="server" BackColor="White" BorderColor="Gray"
BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8pt" ForeColor="Black"
Height="200px" TitleBarColor="WhiteSmoke" TitleBarHeight="20px" TitleBarSeparatorLine="False"
Transparency="35" Width="200px" MagnifierMapResource="Portland" MapResourceManager="MapResourceManager1"
Title="放大镜" Map="Map1" Visible="false">
</esri:Magnifier>
控制放大镜显示和隐藏的,即toggleMagnifierjs脚本:
//放大镜的显示与隐藏
function toggleMagnifier()
{
var mag = $get("Magnifier1");
if (mag != null)
{
toggleFloatingPanelVisibility('Magnifier1');
}
else
{
alert("Magnifier is not available");
}
}