Objective Grid: Displaying bitmaps

Article ID: 58
Last updated: 16 Apr, 2018
Article ID: 58
Last updated: 16 Apr, 2018
Revision: 3
Views: 2080
Posted: 09 Jan, 2001
by Meltreger B.
Updated: 16 Apr, 2018
by Meltreger B.

Problem


How can I display bitmaps?


Cause



Action


CGXStatic supports displaying bitmaps in cells. Bitmaps can be expressed through the value string in a cell. The alignment of bitmaps can be specified with SetHorizontalAlignment() and SetVerticalAlignment().

Examples for using bitmaps are:

SetStyleRange(CGXRange(18, 1),
CGXStyle()
.SetControl(GX_IDS_CTRL_STATIC)
.SetValue("#BMP(121)")
.SetHorizontalAlignment(DT_CENTER)
.SetVerticalAlignment(DT_VCENTER)
);

whereas 127 and 121 (the value in parenthesis) is the resource ID of the bitmap to be displayed in the cell.

You can assign bitmaps to cells depending of the context of the grid when you override GetStyleRowCol() and call style.SetValue(...);

If you don't like using a numeric resource ID, you can also use names.

For example, if a bitmap is declared in your resource file as

YES BITMAP DISCARDABLE "RES\YES12.BMP"

(and YES is not a integer ID defined in resource.h), you can assign this bitmap to cells with:

SetStyleRange(CGXRange(18, 1),
CGXStyle()
.SetControl(GX_IDS_CTRL_STATIC)
.SetValue("#BMP("YES")")
.SetHorizontalAlignment(DT_CENTER)
.SetVerticalAlignment(DT_VCENTER)
);

This article was:   Helpful | Not helpful
Report an issue
Article ID: 58
Last updated: 16 Apr, 2018
Revision: 3
Views: 2080
Posted: 09 Jan, 2001 by Meltreger B.
Updated: 16 Apr, 2018 by Meltreger B.

Others in this category