Skip to content

Latest commit

 

History

History
52 lines (39 loc) · 3.25 KB

File metadata and controls

52 lines (39 loc) · 3.25 KB

WinForms Data Grid - Create thumbnails and load them asynchronously in a TileView

This example shows how to generate background images (thumbnails) for tiles in a TileView and load them asynchronously.

WinForms Data Grid - Create thumbnails and load them asynchronously in a TileView

In this example:

The TileView is bound to a list that contains texture names. We created custom background thumbnails for all tiles based on corresponding texture names, and display these images asynchronously. The AsyncLoad setting enables async tile loading.

private void Form1_Load(object sender, EventArgs e) {
    InitData();
    gridControl1.DataSource = textures;
    tileView1.OptionsTiles.ItemSize = new Size(90, 40);
    tileView1.GetThumbnailImage += TileView1_GetThumbnailImage;
    // Specifies a column that contains information on tile images.
    tileView1.ColumnSet.BackgroundImageColumn = colName;
    tileView1.OptionsImageLoad.RandomShow = true;
    tileView1.OptionsImageLoad.LoadThumbnailImagesFromDataSource = false;
    // Enables async image load.
    tileView1.OptionsImageLoad.AsyncLoad = true;
}

Thumbnails are generated within the GetThumbnailImage event.

private void TileView1_GetThumbnailImage(object sender, DevExpress.Utils.ThumbnailImageEventArgs e) {
    string colorName = textures[e.DataSourceIndex].Name;
    e.ThumbnailImage = GetImage(e.DesiredThumbnailSize, colorName);
}

Files to Review

Does This Example Address Your Development Requirements/Objectives?

(you will be redirected to DevExpress.com to submit your response)