ComponentOne True DBGrid Pro 8
Specifying text-to-picture translations

The same techniques used to specify text-to-text translations can also be used for text-to-picture translations. Within the Values property page, instead of typing a string into the DisplayValue column, you can use the Picture button to select a bitmap to be used for data translations.

To make the Picture button available, move the current cell marquee to the DisplayValue column. Note that the Translate check box must also be selected. Depending upon the height of the bitmaps, you may need to increase the value of the RowHeight property on the General property page. If you do so, you may also want to change the VerticalAlignment member of the grid's Style property to 2 - Vertical Center. This ensures that the bitmaps (as well as textual data in other columns) are centered vertically within grid cells instead of being anchored at the top.

When the program is run, Country field values that match an item in the Value column appear as the corresponding DisplayValue picture.

As with textual translations, the underlying database is not affected; only the presentation of the data value is different. The same effect can be achieved in code as follows:

Example Title
Copy Code
Dim Item As New TrueDBGrid80.ValueItem

 

With TDBGrid1.Columns("Country").ValueItems

    Item.Value = "CAN"

    Item.DisplayValue = LoadPicture("canada.bmp")

    .Add Item

    Item.Value = "UK"

    Item.DisplayValue = LoadPicture("uk.bmp")

    .Add Item

    Item.Value = "USA"

    Item.DisplayValue = LoadPicture("usa.bmp")

    .Add Item

    Item.Value = "JPN"

    Item.DisplayValue = LoadPicture("japan.bmp")

    .Add Item

    Item.Value = "AUS"

    Item.DisplayValue = LoadPicture("australia.bmp")

    .Add Item

    .Translate = True

End With

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback