Skip to main content
A newer version of this page is available. .

ImageTileDataProvider.TileSource Property

Gets or sets a tile source for the image tile provider.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v20.2.dll

NuGet Package: DevExpress.Win.Map

Declaration

[DefaultValue(null)]
public IImageTileSource TileSource { get; set; }

Property Value

Type Default Description
IImageTileSource *null*

An object that implements IImageTileSource interface.

Example

This example shows how to use an ImageTileDataProvider instance to generate map tiles.

View Example

using DevExpress.XtraMap;
using System;
using System.Drawing;
using System.Windows.Forms;

namespace InMemoryTileProvider {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e) {
            ImageTileDataProvider tileDataProvider = new ImageTileDataProvider();
            tileDataProvider.TileSource = new SimpleTileGenerator();
            this.imageLayer1.DataProvider = tileDataProvider;
        }
        public class SimpleTileGenerator : IImageTileSource {
            readonly Font font = new Font("Arial", 10);
            Random rnd = new Random();
            public bool CanDisposeSourceImage => true;
            public string Name => nameof(SimpleTileGenerator);
            public Image GetImage(int x, int y, int level, Size size) {
                Bitmap bitmap = new Bitmap(size.Width, size.Height);
                using (Graphics gr = Graphics.FromImage(bitmap)) {
                    gr.Clear(Color.FromArgb(128, rnd.Next(255),
                            rnd.Next(255), rnd.Next(255)));
                    gr.DrawString(string.Format("{0} {1} {2}", x, y, level),
                           font, Brushes.Black, new PointF(5, 5));
                }
                return bitmap;
            }
        }
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the TileSource property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also