hi every one
how can i change the map background and use jpg image??
thanks
How can change map backgroud
Hi Alireza,
We don’t have a API for directly set a image as background, please let me know whether this code works for you:
public class ImageLayer : Layer
{
protected override void DrawCore(GeoCanvas canvas, System.Collections.ObjectModel.Collection<SimpleCandidate> labelsInAllLayers)
{
DrawingQuality drawingQuality = canvas.DrawingQuality;
string img = @“test.jpg”;
canvas.DrawingQuality = DrawingQuality.HighSpeed;
canvas.DrawWorldImage(new GeoImage(img), canvas.CurrentWorldExtent.GetCenterPoint().X, canvas.CurrentWorldExtent.GetCenterPoint().Y,
canvas.Width, canvas.Height, DrawingLevel.LevelOne);
canvas.DrawingQuality = drawingQuality;
}
}
public partial class DisplayASimpleMap : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
LayerOverlay overlay = new LayerOverlay();
overlay.IsBaseOverlay = true;
overlay.TileType = TileType.SingleTile;
overlay.Layers.Add(new ImageLayer());
Map1.BackgroundOverlay = overlay;
Map1.CurrentExtent = new RectangleShape(-125, 72, 50, -46);
Map1.MapUnit = GeographyUnit.DecimalDegree;
}
}
}
Regards,
Don
Muchos Gracias
Hi Alireza,
You’re welcome.
Regards,
Don
hi again,
when i set background image with this sample, photo used has set to map full screen , But i need to repeat this photo to Covering the whole page
thanks
Hi Alireza,
You can try to use canvas.DrawScreenImageWithoutScaling API instead of canvas.DrawWorldImage, but you need to calculate the center point for each repeat image for make sure their coordinates.
Regards,
Don