ArcGIS API for Silverlight 点击地图弹出自定义窗体

---恢复内容开始---

转载至CSDN:http://blog.csdn.net/taomanman/article/details/7469594,感谢暖枫无敌

在之前的博客中,关于弹出窗体,样式比较单一,不能满足自定义各种样式,源连接地址:http://blog.csdn.net/taomanman/article/details/7333612

 

下面是通过新建一个Silverlight的UserControl类,里面自定义样式,只要你能想到的,都可以做出来,然后在地图中点击点,实例化该类即可,主要代码如下:

[csharp] view plaincopy
  1. <span style="font-size:16px;"><UserControl x:Class="MapClient.MapTip"  
  2.     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
  3.     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
  4.     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
  5.     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  
  6.     mc:Ignorable="d"  
  7.     d:DesignHeight="300" d:DesignWidth="400" Loaded="UserControl_Loaded" Width="400" Height="300">  
  8.       
  9.     <Grid x:Name="LayoutRoot" Background="White" Width="400" Height="300">  
  10.         <Path Data="M1,2 C1,1.4477153 1.4477153,1 2,1 L75,1 L198.18593,-66.997299 L138,1 L360,1 C360.55228,1 361,1.4477153 361,2 L361,255 C361,255.55229 360.55228,256 360,256 L2,256 C1.4477153,256 1,255.55229 1,255 z" Fill="#FFF4F4F5" Margin="0,-79,0,0" Stretch="Fill" Stroke="#FFDAD5D5" StrokeThickness="2" UseLayoutRounding="False" Width="400" Height="379">  
  11.             <Path.Effect>  
  12.                 <DropShadowEffect Color="#FF645F5F"/>  
  13.             </Path.Effect>  
  14.         </Path>  
  15.         <Grid Height="50" Margin="0,1,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="400">  
  16.             <Border BorderBrush="#FF8F8F8F" BorderThickness="0" Margin="16,13,0,17" HorizontalAlignment="Left" Width="70" Background="#FF8F8F8F" Height="20" Cursor="Hand" ToolTipService.ToolTip="实时数据">  
  17.                 <TextBlock x:Name="tb_sssj" TextWrapping="Wrap" Width="65" Height="20" Text="实时数据" Foreground="Black" FontSize="13.333" HorizontalAlignment="Center" VerticalAlignment="Center"/>  
  18.             </Border>  
  19.             <Border BorderBrush="#FF8F8F8F" BorderThickness="0" Margin="90,13,0,17" Background="#FF8F8F8F" Height="20" HorizontalAlignment="Left" Width="70" Cursor="Hand" ToolTipService.ToolTip="田间视频">  
  20.                 <TextBlock x:Name="tb_tjsp" TextWrapping="Wrap" Width="60" Height="20" Text="田间视频" Foreground="#FFFDFDFD" FontSize="13.333" HorizontalAlignment="Center" VerticalAlignment="Center" MouseLeftButtonDown="tb_tjsp_MouseLeftButtonDown"/>  
  21.             </Border>  
  22.             <Border BorderBrush="#FF8F8F8F" BorderThickness="0" Margin="164,13,166,17" Background="#FF8F8F8F" Height="20" Cursor="Hand" ToolTipService.ToolTip="作物图片">  
  23.                 <TextBlock x:Name="tb_zwtp" TextWrapping="Wrap" Width="60" Height="20" Text="作物图片" Foreground="#FFFDFDFD" FontSize="13.333" HorizontalAlignment="Center" VerticalAlignment="Center" MouseLeftButtonDown="tb_zwtp_MouseLeftButtonDown"/>  
  24.             </Border>  
  25.             <Border BorderBrush="#FF8F8F8F" BorderThickness="0" Margin="0,13,92,17" Background="#FF8F8F8F" Height="20" HorizontalAlignment="Right" Width="70" Cursor="Hand" ToolTipService.ToolTip="专家会议">  
  26.                 <TextBlock x:Name="tb_zjhy" TextWrapping="Wrap" Width="60" Height="20" Text="专家会议" Foreground="#FFFDFDFD" FontSize="13.333" HorizontalAlignment="Center" VerticalAlignment="Center" MouseLeftButtonDown="tb_zjhy_MouseLeftButtonDown"/>  
  27.             </Border>  
  28.             <Border BorderBrush="#FF8F8F8F" BorderThickness="0" Margin="0,13,17,17" Background="#FF8F8F8F" Height="20" HorizontalAlignment="Right" Width="70" Cursor="Hand" ToolTipService.ToolTip="现场联动">  
  29.                 <TextBlock x:Name="tb_xcld" TextWrapping="Wrap" Width="60" Height="20" Text="现场联动" Foreground="#FFFDFDFD" FontSize="13.333" HorizontalAlignment="Center" VerticalAlignment="Center" MouseLeftButtonDown="tb_xcld_MouseLeftButtonDown"/>  
  30.             </Border>  
  31.         </Grid>  
  32.         <Grid Height="8" Margin="-2,41,2,0" VerticalAlignment="Top" Width="400">  
  33.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" HorizontalAlignment="Center" Height="1" Margin="0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" Width="7"/>  
  34.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="4.404,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  35.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="187.829,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  36.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="177.824,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  37.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="167.819,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  38.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="158.481,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  39.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="149.81,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  40.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="139.805,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  41.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="130.467,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  42.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="120.462,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  43.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="111.124,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  44.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="101.786,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  45.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="92.448,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  46.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="83.777,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  47.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="74.439,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  48.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="65.768,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  49.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="55.763,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  50.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="46.425,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  51.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="37.087,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  52.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="29.75,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  53.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="22.413,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  54.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="13.742,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  55.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,187.162,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  56.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,177.824,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  57.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,168.486,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  58.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,158.481,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  59.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,149.81,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  60.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,140.472,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  61.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,130.467,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  62.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,120.462,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  63.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,111.791,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  64.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,101.786,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  65.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,92.448,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  66.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,83.11,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  67.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,73.772,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  68.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,65.101,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  69.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,56.43,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  70.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,47.759,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  71.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,38.421,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  72.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,29.083,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  73.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,19.745,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  74.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,10.407,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  75.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,1.736,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  76.         </Grid>  
  77.         <Grid Margin="-2,0,2,58" Height="8" VerticalAlignment="Bottom" Width="400">  
  78.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" HorizontalAlignment="Center" Height="1" Margin="0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" Width="7"/>  
  79.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="4.404,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  80.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="187.829,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  81.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="177.824,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  82.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="167.819,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  83.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="158.481,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  84.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="149.81,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  85.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="139.805,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  86.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="130.467,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  87.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="120.462,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  88.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="111.124,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  89.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="101.786,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  90.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="92.448,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  91.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="83.777,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  92.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="74.439,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  93.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="65.768,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  94.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="55.763,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  95.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="46.425,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  96.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="37.087,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  97.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="29.75,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  98.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="22.413,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  99.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="13.742,0,0,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Left" Width="7"/>  
  100.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,187.162,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  101.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,177.824,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  102.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,168.486,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  103.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,158.481,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  104.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,149.81,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  105.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,140.472,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  106.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,130.467,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  107.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,120.462,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  108.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,111.791,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  109.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,101.786,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  110.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,92.448,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  111.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,83.11,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  112.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,73.772,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  113.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,65.101,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  114.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,56.43,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  115.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,47.759,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  116.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,38.421,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  117.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,29.083,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  118.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,19.745,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  119.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,10.407,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  120.             <Path Data="M61.333332,0 L67.333336,0" Fill="#FFF4F4F5" Height="1" Margin="0,0,1.736,0" Stretch="Fill" Stroke="#FFDAD5D5" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Right" Width="7"/>  
  121.         </Grid>  
  122.         <Grid Height="61" Margin="0" VerticalAlignment="Bottom" Width="400" Background="#FFE5E5E5">  
  123.             <Grid.ColumnDefinitions>  
  124.                 <ColumnDefinition Width="0.082*"/>  
  125.                 <ColumnDefinition Width="0.918*"/>  
  126.             </Grid.ColumnDefinitions>  
  127.             <Grid.RowDefinitions>  
  128.                 <RowDefinition Height="0.327*"/>  
  129.                 <RowDefinition Height="0.337*"/>  
  130.                 <RowDefinition Height="0.337*"/>  
  131.             </Grid.RowDefinitions>  
  132.             <Ellipse Fill="#FFFDFDFD" HorizontalAlignment="Right" Margin="0,6,3,6" Stroke="#FF48C803" Width="8" Height="8"/>  
  133.             <Ellipse Fill="#FFFDFDFD" HorizontalAlignment="Right" Margin="0,8,3,5" Stroke="#FF48C803" Width="8" Grid.Row="1" Height="8"/>  
  134.             <Ellipse Fill="#FFFDFDFD" HorizontalAlignment="Right" Margin="0,7,3,5" Stroke="#FF48C803" Width="8" Grid.Row="2" Height="8"/>  
  135.             <HyperlinkButton x:Name="btn1" Content="" Grid.Column="1" HorizontalAlignment="Left" Margin="4,1,0,1" FontSize="13.333" Foreground="Black" Click="btn1_Click" Height="20" ToolTipService.ToolTip="点击查看详情"/>  
  136.             <HyperlinkButton x:Name="btn2" Content="" Grid.Column="1" HorizontalAlignment="Left" Margin="4,1,0,2" FontSize="13.333" Grid.Row="1" Foreground="Black" Click="btn2_Click" Height="20" ToolTipService.ToolTip="点击查看详情"/>  
  137.             <HyperlinkButton x:Name="btn3" Content="" Grid.Column="1" HorizontalAlignment="Left" Margin="4,1,0,1" FontSize="13.333" Grid.Row="2" Foreground="Black" Click="btn3_Click" Height="20" ToolTipService.ToolTip="点击查看详情"/>  
  138.         </Grid>  
  139.         <Grid Height="20" Margin="0,49,0,0" VerticalAlignment="Top" Width="400">  
  140.             <TextBlock x:Name="tb_title" HorizontalAlignment="Left" Margin="17,0,0,0" TextWrapping="Wrap" Width="153" FontSize="13.333" Height="20" Foreground="#FFFD9312"/>  
  141.         </Grid>  
  142.         <Grid Margin="0,69,0,66" Width="400" Height="165">  
  143.             <Grid.ColumnDefinitions>  
  144.                 <ColumnDefinition Width="0.155*"/>  
  145.                 <ColumnDefinition Width="0.672*"/>  
  146.                 <ColumnDefinition Width="0.172*"/>  
  147.             </Grid.ColumnDefinitions>  
  148.             <Grid.RowDefinitions>  
  149.                 <RowDefinition Height="18"/>  
  150.                 <RowDefinition Height="19"/>  
  151.                 <RowDefinition Height="19"/>  
  152.                 <RowDefinition Height="20"/>  
  153.                 <RowDefinition Height="20"/>  
  154.                 <RowDefinition Height="21"/>  
  155.                 <RowDefinition Height="19"/>  
  156.                 <RowDefinition Height="20"/>  
  157.                 <RowDefinition Height="9"/>  
  158.             </Grid.RowDefinitions>  
  159.             <Border BorderBrush="#FFF9F00E" BorderThickness="0" Grid.Column="1" Background="#FFF9F00E" HorizontalAlignment="Left" Width="269" Height="20">  
  160.                 <TextBlock x:Name="tb_grade" Margin="0,0,36,0" TextWrapping="Wrap" FontSize="13.333"/>  
  161.             </Border>  
  162.             <Border BorderBrush="#FFF9F00E" BorderThickness="0" Grid.Column="1" Background="#FFF9F00E" Margin="0,2,0,-1" Grid.Row="1" HorizontalAlignment="Left" Width="269" Height="20">  
  163.                 <TextBlock x:Name="tb_area" Margin="0,0,36,0" TextWrapping="Wrap" FontSize="13.333"/>  
  164.             </Border>  
  165.             <Border BorderBrush="#FFF9F00E" BorderThickness="0" Grid.Column="1" Background="#FFF9F00E" Margin="0,3,0,-2" Grid.Row="2" HorizontalAlignment="Left" Width="269" Height="20">  
  166.                 <TextBlock x:Name="tb_variety" Margin="0,0,36,0" TextWrapping="Wrap" FontSize="13.333"/>  
  167.             </Border>  
  168.             <Border BorderBrush="#FFF9F00E" BorderThickness="0" Grid.Column="1" Background="#FFF9F00E" Margin="0,4,0,-2" Grid.Row="3" HorizontalAlignment="Left" Width="269" Height="20">  
  169.                 <TextBlock x:Name="tb_varietyType" Margin="0,0,36,0" TextWrapping="Wrap" FontSize="13.333"/>  
  170.             </Border>  
  171.             <Border BorderBrush="#FFF9F00E" BorderThickness="0" Grid.Column="1" Background="#FFF9F00E" Margin="0,4,0,-2" Grid.Row="4" HorizontalAlignment="Left" Width="269" Height="20">  
  172.                 <TextBlock x:Name="tb_zjyl" Margin="0,0,36,0" TextWrapping="Wrap" FontSize="13.333"/>  
  173.             </Border>  
  174.             <Border BorderBrush="#FFF9F00E" BorderThickness="0" Grid.Column="1" Background="#FFF9F00E" Margin="0,4,0,-1" Grid.Row="5" HorizontalAlignment="Left" Width="269" Height="20">  
  175.                 <TextBlock x:Name="tb_dzjn" Margin="0,0,36,0" TextWrapping="Wrap" FontSize="13.333"/>  
  176.             </Border>  
  177.             <Border BorderBrush="#FFF9F00E" BorderThickness="0" Grid.Column="1" Background="#FFF9F00E" Margin="0,3,0,-2" Grid.Row="6" HorizontalAlignment="Left" Width="269" Height="20">  
  178.                 <TextBlock x:Name="tb_csg" Margin="0,0,36,0" TextWrapping="Wrap" FontSize="13.333"/>  
  179.             </Border>  
  180.             <Border BorderBrush="#FFF9F00E" BorderThickness="0" Grid.Column="1" Background="#FFF9F00E" Margin="0,4,0,-2" Grid.Row="7" HorizontalAlignment="Left" Width="269" Height="20">  
  181.                 <TextBlock x:Name="tb_mjn" Margin="0,0,36,0" TextWrapping="Wrap" FontSize="13.333"/>  
  182.             </Border>  
  183.         </Grid>  
  184.     </Grid>  
  185. </UserControl>  
  186. </span>  

 

[csharp] view plaincopy
  1. <span style="font-size:16px;">using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Net;  
  5. using System.Windows;  
  6. using System.Windows.Controls;  
  7. using System.Windows.Documents;  
  8. using System.Windows.Input;  
  9. using System.Windows.Media;  
  10. using System.Windows.Media.Animation;  
  11. using System.Windows.Shapes;  
  12. using MapClient.ServiceReference1;  
  13. using System.Windows.Browser;  
  14. using System.Windows.Controls.Primitives;  
  15. using ESRI.ArcGIS.Client;  
  16.   
  17. namespace MapClient  
  18. {  
  19.     public partial class MapTip : UserControl  
  20.     {  
  21.         string _placeName = string.Empty; //监测点名称  
  22.         string _areaID = string.Empty; //地区编号  
  23.         string _monitorID = string.Empty; //监测点ID  
  24.         string _year = string.Empty; //年份  
  25.         string _issueNum = string.Empty; //期号  
  26.         string _cycleID = string.Empty; //生育周期ID  
  27.         string _seedingTypeID = string.Empty; //苗情等级ID  
  28.   
  29.         private Point _location;  
  30.         private bool _isShowing;  
  31.         private Popup _popup;  
  32.         private Grid _grid;  
  33.         private Canvas _canvas;  
  34.         private FrameworkElement _content;  
  35.   
  36.         //初始化并显示弹出窗体.公共方法在显示菜单项时调用  
  37.         public void Show(Point location)  
  38.         {  
  39.             if (_isShowing)  
  40.                 throw new InvalidOperationException();  
  41.             _isShowing = true;  
  42.             _location = location;  
  43.             ConstructPopup();  
  44.             _popup.IsOpen = true;  
  45.         }  
  46.   
  47.         //关闭弹出窗体  
  48.         public void Close()  
  49.         {  
  50.             _isShowing = false;  
  51.             if (_popup != null)  
  52.             {  
  53.                 _popup.IsOpen = false;  
  54.             }  
  55.         }  
  56.   
  57.         //Default behavior for OnClickOutside() is to close the context menu when there is a mouse click event outside the context menu  
  58.         protected virtual void OnClickOutside()  
  59.         {  
  60.             Close();  
  61.         }  
  62.   
  63.         // 用Grid来布局,初始化弹出窗体  
  64.         //在Grid里面添加一个Canvas,用来监测菜单项外面的鼠标点击事件  
  65.         private void ConstructPopup()  
  66.         {  
  67.             if (_popup != null)  
  68.                 return;  
  69.             _popup = new Popup();  
  70.             _grid = new Grid();  
  71.             _popup.Child = _grid;  
  72.             _canvas = new Canvas();  
  73.             _canvas.MouseLeftButtonDown += (sender, args) => { OnClickOutside(); };  
  74.             _canvas.MouseRightButtonDown += (sender, args) => { args.Handled = true; OnClickOutside(); };  
  75.             _canvas.Background = new SolidColorBrush(Colors.Transparent);  
  76.             _grid.Children.Add(_canvas);  
  77.             _content = this;  
  78.             _content.HorizontalAlignment = HorizontalAlignment.Left;  
  79.             _content.VerticalAlignment = VerticalAlignment.Top;  
  80.             _content.Margin = new Thickness(_location.X, _location.Y, 0, 0);  
  81.             _grid.Children.Add(_content);  
  82.             UpdateSize();  
  83.         }  
  84.   
  85.         /// <summary>  
  86.         /// 更新大小  
  87.         /// </summary>  
  88.         private void UpdateSize()  
  89.         {  
  90.             _grid.Width = Application.Current.Host.Content.ActualWidth;  
  91.             _grid.Height = Application.Current.Host.Content.ActualHeight;  
  92.             if (_canvas != null)  
  93.             {  
  94.                 _canvas.Width = _grid.Width;  
  95.                 _canvas.Height = _grid.Height;  
  96.             }  
  97.         }  
  98.   
  99.         public MapTip(string name, string areaID, string monitorID, string year, string cycleID, string issueNum, string seedingTypeID)  
  100.         {  
  101.             InitializeComponent();  
  102.             this._placeName = name;  
  103.             this._areaID = areaID;  
  104.             this._monitorID = monitorID;  
  105.             this._issueNum = issueNum;  
  106.             this._year = year;  
  107.             this._cycleID = cycleID;  
  108.             this._seedingTypeID = seedingTypeID;  
  109.         }  
  110.   
  111.         private void UserControl_Loaded(object sender, RoutedEventArgs e)  
  112.         {  
  113.             getData1SoapClient client = new getData1SoapClient();  
  114.             client.GetMonitorInfoByIssueNumCompleted += new EventHandler<GetMonitorInfoByIssueNumCompletedEventArgs>(client_GetMonitorInfoByIssueNumCompleted);  
  115.             client.GetMonitorInfoByIssueNumAsync(_areaID, _monitorID, _year, _issueNum, _cycleID);  
  116.         }  
  117.   
  118.         void client_GetMonitorInfoByIssueNumCompleted(object sender, GetMonitorInfoByIssueNumCompletedEventArgs e)  
  119.         {  
  120.             try  
  121.             {  
  122.                 string result = e.Result;  
  123.                 if (result.Split('|').Length == 1)  
  124.                 {  
  125.                     this.tb_title.Text = _placeName;  
  126.                     this.tb_zjyl.Text = result.Split('|')[0].ToString();  
  127.                     this.tb_zjyl.Foreground = new SolidColorBrush(Colors.Red);  
  128.                     this.tb_zjyl.HorizontalAlignment = HorizontalAlignment.Center;  
  129.                 }  
  130.                 else  
  131.                 {  
  132.                     this.tb_title.Text = result.Split('|')[0].ToString(); //标题  
  133.                     this.tb_grade.Text = result.Split('|')[1].ToString(); //所属类型  
  134.                     this.tb_area.Text = result.Split('|')[2].ToString(); //代表面积  
  135.                     this.tb_variety.Text = result.Split('|')[3].ToString(); //品种  
  136.                     this.tb_varietyType.Text = result.Split('|')[4].ToString(); //品种类型  
  137.                     switch (_cycleID)  
  138.                     {  
  139.                         case "5":  
  140.                             //越冬期  
  141.                             this.tb_zjyl.Text = result.Split('|')[5].ToString(); //主茎叶龄  
  142.                             this.tb_dzjn.Text = result.Split('|')[6].ToString(); //单株茎蘖  
  143.                             this.tb_csg.Text = result.Split('|')[7].ToString(); //次生根  
  144.                             this.tb_mjn.Text = result.Split('|')[8].ToString(); //亩茎蘖  
  145.                             break;  
  146.                         case "6":  
  147.                             //返青期  
  148.                             this.tb_zjyl.Text = result.Split('|')[5].ToString(); //主茎叶龄  
  149.                             this.tb_dzjn.Text = result.Split('|')[6].ToString(); //单株茎蘖  
  150.                             this.tb_csg.Text = result.Split('|')[7].ToString(); //次生根  
  151.                             this.tb_mjn.Text = result.Split('|')[8].ToString(); //亩茎蘖  
  152.                             break;  
  153.                         case "8":  
  154.                             //拔节期  
  155.                             this.tb_zjyl.Text = result.Split('|')[5].ToString(); //主茎叶龄  
  156.                             this.tb_dzjn.Text = result.Split('|')[6].ToString(); //单株茎蘖  
  157.                             this.tb_csg.Text = result.Split('|')[7].ToString(); //亩茎蘖  
  158.                             break;  
  159.                         case "10":  
  160.                             //抽穗期  
  161.                             this.tb_zjyl.Text = result.Split('|')[5].ToString(); //主茎叶龄  
  162.                             this.tb_dzjn.Text = result.Split('|')[6].ToString(); //亩茎蘖  
  163.                             break;  
  164.                     }  
  165.                     //苗情评价分析  
  166.                     btn1.Content = result.Split('|')[0].ToString().Split(')')[0] + ")苗情评价信息";  
  167.                     //苗情数据报表  
  168.                     btn2.Content = result.Split('|')[0].ToString().Split(')')[0] + ")小麦苗情数据报表";  
  169.                     //苗情监测报告  
  170.                     btn3.Content = result.Split('|')[0].ToString().Split(')')[0] + ")苗情监测报告";  
  171.                 }  
  172.             }  
  173.             catch (Exception)  
  174.             {  
  175.                 this.tb_title.Text = _placeName;  
  176.                 this.tb_zjyl.Text = "暂无数据!";  
  177.                 this.tb_zjyl.Foreground = new SolidColorBrush(Colors.Red);  
  178.                 this.tb_zjyl.HorizontalAlignment = HorizontalAlignment.Center;  
  179.             }  
  180.         }  
  181.   
  182.         void btn1_Click(object sender, RoutedEventArgs e)  
  183.         {  
  184.             //页面跳转后并关闭当前弹出窗体  
  185.             try  
  186.             {  
  187.                 ScriptObject SetMaterial = HtmlPage.Window.GetProperty("GotoHomeMenuName"as ScriptObject;  
  188.                 string firstMenuName = "农情分析";  
  189.                 string secondMenuName = "苗情评价";  
  190.                 string menuName = "GIS地图监测点小麦苗情评价";  
  191.                 string str = "?pAreaType=&pCounty=" + _areaID + "&pYear=" + _year + "&pPeriod=" + _issueNum + "&pStageID=" + _cycleID + "&pSeedlingType=" + _seedingTypeID + "&pMonitorID=" + _monitorID;  
  192.                 SetMaterial.InvokeSelf(firstMenuName, secondMenuName, menuName, str);  
  193.             }  
  194.             catch (Exception ex)  
  195.             {  
  196.                 throw (ex);  
  197.             }  
  198.             Close();  
  199.         }  
  200.   
  201.         void btn2_Click(object sender, RoutedEventArgs e)  
  202.         {  
  203.             //页面跳转后并关闭当前弹出窗体  
  204.             ScriptObject SetMaterial = HtmlPage.Window.GetProperty("GotoHomeUrlStr"as ScriptObject;  
  205.             string firstMenuName = "农情分析";  
  206.             string secondMenuName = "苗情分布统计分析";  
  207.             string thirdMenuName = "苗情分布统计";  
  208.             string str = "?AreaName=" + _placeName;  
  209.             SetMaterial.InvokeSelf(firstMenuName, secondMenuName, thirdMenuName, str);  
  210.             Close();  
  211.         }  
  212.   
  213.         void btn3_Click(object sender, RoutedEventArgs e)  
  214.         {  
  215.             //页面跳转后并关闭当前弹出窗体  
  216.             ScriptObject SetMaterial = HtmlPage.Window.GetProperty("GotoHomeUrlStr"as ScriptObject;  
  217.             string firstMenuName = "农情管理";  
  218.             string secondMenuName = "信息录入";  
  219.             string thirdMenuName = "小麦苗情监测报告";  
  220.             string str = "?AreaName=" + _placeName;  
  221.             SetMaterial.InvokeSelf(firstMenuName, secondMenuName, thirdMenuName, str);  
  222.             Close();  
  223.         }  
  224.   
  225.   
  226.         private void tb_zjhy_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)  
  227.         {  
  228.             //专家会议  
  229.             ScriptObject SetMaterial = HtmlPage.Window.GetProperty("GotoHomeUrlStr"as ScriptObject;  
  230.             string firstMenuName = "农情监控";  
  231.             string secondMenuName = "农情监控";  
  232.             string thirdMenuName = "农田监控";  
  233.             string str = "?AreaName=" + _placeName;  
  234.             SetMaterial.InvokeSelf(firstMenuName, secondMenuName, thirdMenuName, str);  
  235.             Close();  
  236.         }  
  237.   
  238.         private void tb_xcld_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)  
  239.         {  
  240.             //现场联动  
  241.             ScriptObject SetMaterial = HtmlPage.Window.GetProperty("GotoHomeUrlStr"as ScriptObject;  
  242.             string firstMenuName = "农情监控";  
  243.             string secondMenuName = "农情监控";  
  244.             string thirdMenuName = "农田图像监控";  
  245.             string str = "?AreaName=" + _placeName;  
  246.             SetMaterial.InvokeSelf(firstMenuName, secondMenuName, thirdMenuName, str);  
  247.             Close();  
  248.         }  
  249.   
  250.         private void tb_tjsp_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)  
  251.         {  
  252.             // 田间视频  
  253.             ScriptObject SetMaterial = HtmlPage.Window.GetProperty("GotoHomeUrlStr"as ScriptObject;  
  254.             string firstMenuName = "农情监控";  
  255.             string secondMenuName = "农情监控";  
  256.             string thirdMenuName = "农田图像监控";  
  257.             string str = "?AreaName=" + _placeName;  
  258.             SetMaterial.InvokeSelf(firstMenuName, secondMenuName, thirdMenuName, str);  
  259.             Close();  
  260.         }  
  261.   
  262.         private void tb_zwtp_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)  
  263.         {  
  264.             // 作物图片  
  265.             ScriptObject SetMaterial = HtmlPage.Window.GetProperty("GotoHomeUrlStr"as ScriptObject;  
  266.             string firstMenuName = "农情监控";  
  267.             string secondMenuName = "农情监控";  
  268.             string thirdMenuName = "农田图像监控";  
  269.             string str = "?AreaName=" + _placeName;  
  270.             SetMaterial.InvokeSelf(firstMenuName, secondMenuName, thirdMenuName, str);  
  271.             Close();  
  272.         }  
  273.   
  274.     }  
  275. }  
  276. </span>  


[csharp] view plaincopy
  1. <span style="font-size:16px;">         #region 鼠标左键事件开始  
  2.         void Feature_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)  
  3.         {  
  4.             //鼠标左键,显示ToolTip信息  
  5.             Graphic g = sender as Graphic;  
  6.             for (int i = 0; i < areaId.Length; i++)  
  7.             {  
  8.                 if (areaId[i] == g.Attributes["Id"].ToString())  
  9.                 {  
  10.                     //弹出对应的提示信息  
  11.                     MapTip tip = new MapTip(g.Attributes["Name"].ToString(), g.Attributes["AreaID"].ToString(), areaId[i], year[i], cycleId[i], issueNum[i], seedlingType[i]);  
  12.                     Point p = e.GetPosition(LayoutRoot);  
  13.                     p.X = p.X - 220;  
  14.                     p.Y = p.Y + 80;  
  15.                     tip.Show(p);  
  16.                 }  
  17.             }  
  18.         }</span>  


效果如下图所示:


 

---恢复内容结束---

posted on 2013-02-13 21:29  未济的Lakers  阅读(1468)  评论(0编辑  收藏  举报

导航