using System;using System.Net;using System.windows;using System.windows.Controls;using System.windows.documents;using System.windows.Ink;using System.windows.input;using System.windows.Media;using System.windows.Media.Animation;using System.windows.Shapes;namespace Syit.CommonClass{ public static class colorRevert { #region 颜色转换 public static color Tocolor(this string colorname) { if (colorname.StartsWith("#")) colorname = colorname.Replace("#",string.Empty); int v = int.Parse(colorname,System.Globalization.NumberStyles.Hexnumber); return new color() { A = Convert.ToByte((v >> 24) & 255),R = Convert.ToByte((v >> 16) & 255),G = Convert.ToByte((v >> 8) & 255),B = Convert.ToByte((v >> 0) & 255) }; } public static int ToArgb(this color color) { int argb = color.A << 24; argb += color.R << 16; argb += color.G << 8; argb += color.B; return argb; } #endregion }}
private voID btography_MouseleftbuttonDown(object sender,System.windows.input.MousebuttonEventArgs e) { e.Handled = true; } private voID btography_MouseleftbuttonUp(object sender,System.windows.input.MousebuttonEventArgs e) { //设置背景颜色 this.rect1.stroke = new SolIDcolorBrush(colorRevert.Tocolor("#FFF29536")); this.rect2.stroke = new SolIDcolorBrush(colorRevert.Tocolor("#FF7392BD")); this.rect3.stroke = new SolIDcolorBrush(colorRevert.Tocolor("#FF7392BD")); setSelectedlinearGradIEntBrush(rect1); setUnSelectedlinearGradIEntBrush(rect2); setUnSelectedlinearGradIEntBrush(rect3); //设置地图显示与隐藏 topographyLayer.Visible = true; //Google地形图 roadLayer.Visible = false; //Google交通图 sateliateLayer.Visible = false; //Google卫星图 sateliateTextLayer.Visible = false; //Google卫星图文字 } private voID broad_MouseleftbuttonDown(object sender,System.windows.input.MousebuttonEventArgs e) { e.Handled = true; } private voID broad_MouseleftbuttonUp(object sender,System.windows.input.MousebuttonEventArgs e) { //设置背景颜色 this.rect1.stroke = new SolIDcolorBrush(colorRevert.Tocolor("#FF7392BD")); this.rect2.stroke = new SolIDcolorBrush(colorRevert.Tocolor("#FFF29536")); this.rect3.stroke = new SolIDcolorBrush(colorRevert.Tocolor("#FF7392BD")); setUnSelectedlinearGradIEntBrush(rect1); setSelectedlinearGradIEntBrush(rect2); setUnSelectedlinearGradIEntBrush(rect3); //设置地图显示与隐藏 topographyLayer.Visible = false; //Google地形图 roadLayer.Visible = true; //Google交通图 sateliateLayer.Visible = false; //Google卫星图 sateliateTextLayer.Visible = false; //Google卫星图文字 } private voID bsateliate_MouseleftbuttonDown(object sender,System.windows.input.MousebuttonEventArgs e) { e.Handled = true; } private voID bsateliate_MouseleftbuttonUp(object sender,System.windows.input.MousebuttonEventArgs e) { //设置背景颜色 this.rect1.stroke = new SolIDcolorBrush(colorRevert.Tocolor("#FF7392BD")); this.rect2.stroke = new SolIDcolorBrush(colorRevert.Tocolor("#FF7392BD")); this.rect3.stroke = new SolIDcolorBrush(colorRevert.Tocolor("#FFF29536")); setUnSelectedlinearGradIEntBrush(rect1); setUnSelectedlinearGradIEntBrush(rect2); setSelectedlinearGradIEntBrush(rect3); //设置地图显示与隐藏 topographyLayer.Visible = false; //Google地形图 roadLayer.Visible = false; //Google交通图 sateliateLayer.Visible = true; //Google卫星图 sateliateTextLayer.Visible = true; //Google卫星图文字 } //选中状态 public voID setSelectedlinearGradIEntBrush(Rectangle rect) { //设置stroke值 rect.stroke = new SolIDcolorBrush(colorRevert.Tocolor("#FFF29536")); //设置渐变色 GradIEntStop gs = new GradIEntStop(); gs.Offset = 0.0; gs.color = colorRevert.Tocolor("#FFFDF6DF"); GradIEntStop gs1 = new GradIEntStop(); gs1.Offset = 1.0; gs1.color = colors.White; GradIEntStop gs2 = new GradIEntStop(); gs2.Offset = 0.5; gs2.color = colorRevert.Tocolor("#FFF9E8B2"); GradIEntStop gs3 = new GradIEntStop(); gs3.Offset = 0.5; gs3.color = colorRevert.Tocolor("#FFFFD75D"); linearGradIEntBrush lgb = new linearGradIEntBrush(); lgb.StartPoint = new Point(0.5,0); lgb.EndPoint = new Point(0.5,1); lgb.GradIEntStops.Add(gs); lgb.GradIEntStops.Add(gs1); lgb.GradIEntStops.Add(gs2); lgb.GradIEntStops.Add(gs3); rect.Fill = lgb; } //未选中状态 public voID setUnSelectedlinearGradIEntBrush(Rectangle rect) { //设置stroke值 rect.stroke = new SolIDcolorBrush(colorRevert.Tocolor("#FF7392BD")); //设置渐变色 GradIEntStop gs = new GradIEntStop(); gs.Offset = 0.0; gs.color = colorRevert.Tocolor("#FFF5F6FB"); GradIEntStop gs1 = new GradIEntStop(); gs1.Offset = 1.0; gs1.color = colorRevert.Tocolor("#FFE6Edfc"); GradIEntStop gs2 = new GradIEntStop(); gs2.Offset = 0.5; gs2.color = colorRevert.Tocolor("#FFE6EBF5"); GradIEntStop gs3 = new GradIEntStop(); gs3.Offset = 0.5; gs3.color = colorRevert.Tocolor("#FFD7E3F7"); linearGradIEntBrush lgb = new linearGradIEntBrush(); lgb.StartPoint = new Point(0.5,1); lgb.GradIEntStops.Add(gs); lgb.GradIEntStops.Add(gs1); lgb.GradIEntStops.Add(gs2); lgb.GradIEntStops.Add(gs3); rect.Fill = lgb; }
<border HorizontalAlignment="left" margin="50,5,0" WIDth="230" borderThickness="1" CornerRadius="5" VerticalAlignment="top"> <border.Effect> <DropShadowEffect Direction="-90" color="#FF4D4D4D" ShadowDepth="4"/> </border.Effect> <border.Background> <linearGradIEntBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradIEntStop color="#FFDDF1FD" Offset="0"/> <GradIEntStop color="#FFCAE9FC" Offset="1"/> </linearGradIEntBrush> </border.Background> <GrID HorizontalAlignment="left" WIDth="229"> <border x:name="btography" HorizontalAlignment="left" margin="16,4,4" WIDth="64" MouseleftbuttonDown="btography_MouseleftbuttonDown" MouseleftbuttonUp="btography_MouseleftbuttonUp"> <GrID> <Rectangle stroke="#FFF29536" RadiusX="1" RadiusY="1" x:name ="rect1"> <Rectangle.Fill> <linearGradIEntBrush EndPoint="0.5,0"> <GradIEntStop color="#FFFDF6DF" Offset="0"/> <GradIEntStop color="White" Offset="1"/> <GradIEntStop color="#FFF9E8B2" Offset="0.5"/> <GradIEntStop color="#FFFFD75D" Offset="0.5"/> </linearGradIEntBrush> </Rectangle.Fill> </Rectangle> <TextBlock margin="16,6,13,2" textwrapPing="Wrap" Text="地形" Foreground="#FF0B333C" FontWeight="Bold" FontSize="14.667" FontFamily="Simsun"/> </GrID> </border> <border x:name="broad" margin="84,81,4" MouseleftbuttonDown="broad_MouseleftbuttonDown" MouseleftbuttonUp="broad_MouseleftbuttonUp"> <GrID> <Rectangle stroke="#FF7392BD" RadiusX="1" RadiusY="1" x:name ="rect2"> <Rectangle.Fill> <linearGradIEntBrush EndPoint="0.5,0"> <GradIEntStop color="#FFF5F6FB" Offset="0"/> <GradIEntStop color="#FFE6Edfc" Offset="1"/> <GradIEntStop color="#FFE6EBF5" Offset="0.5"/> <GradIEntStop color="#FFD7E3F7" Offset="0.5"/> </linearGradIEntBrush> </Rectangle.Fill> </Rectangle> <TextBlock margin="17,11,2" textwrapPing="Wrap" Text="街道" Foreground="#FF0B333C" FontWeight="Bold" FontSize="14.667" FontFamily="Simsun"/> </GrID> </border> <border x:name="bsateliate" HorizontalAlignment="Right" margin="0,14,4" WIDth="64" MouseleftbuttonDown="bsateliate_MouseleftbuttonDown" MouseleftbuttonUp="bsateliate_MouseleftbuttonUp"> <GrID> <Rectangle stroke="#FF7392BD" RadiusX="1" RadiusY="1" x:name ="rect3"> <Rectangle.Fill> <linearGradIEntBrush EndPoint="0.5,0"> <GradIEntStop color="#FFF5F6FB" Offset="0"/> <GradIEntStop color="#FFE6Edfc" Offset="1"/> <GradIEntStop color="#FFE6EBF5" Offset="0.5"/> <GradIEntStop color="#FFD7E3F7" Offset="0.5"/> </linearGradIEntBrush> </Rectangle.Fill> </Rectangle> <TextBlock margin="18,12,2" textwrapPing="Wrap" Text="影像" Foreground="#FF0B333C" FontWeight="Bold" FontSize="14.667" FontFamily="Simsun"/> </GrID> </border> </GrID> </border>总结
以上是内存溢出为你收集整理的ArcGIS API for Silverlight 加载google地图全部内容,希望文章能够帮你解决ArcGIS API for Silverlight 加载google地图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)