Click to See Complete Forum and Search --> : MS Flexgrid


learner123
May 6th, 1999, 01:20 AM
The following is the problem faced by me with MS flexgrid. I have to have any one of the three values (cross, tick and blank ) shown on click of any cell in an MS Flexgrid.

case 1 :
I have used the character "X" for the cross and tried using character corresponding to Value 65 in the font Marlett for the tick mark, which does not work and I dont see the tick mark on the cell.

case 2 :
I tried positioning bitmaps on the grid by using the BitBlt function to put a bitmap on the grid cell. The problem here is that after a bitblt the whole grid repainted bcos of which the previously placed bitmap is lost.

case 3 :
I tried using the picture related functions that MSFlexgrid provides. I was not able to properly do the same.

Surendra
May 6th, 1999, 02:04 AM
Hi,

Here is one of the method that I have used to put check box bitmap in MS Flex Grid Cell.

1. Insert the MS FlexGrid control - along with it the CPicture Class will be inserted into your project.

2. Create the bitmaps you want to insert - usingthe resource editor. In my case the IDs were
IDB_CHECK, IDB_NOCHECK.

3. Now add following member variables to the class which controls the grid. (It may be the view class or the Dialog class - In my case it was view ).

CPictureHolder m_picUnCheck; //Uncheck bitmap
CPictureHolder m_picCheck; //Check bitmap holder

4. In the OnInitialUpdate (or OnInitDialog), add the code to load the bitmap. i.e

m_picCheck.CreateFromBitmap(IDB_CHECK);
m_picUnCheck.CreateFromBitmap(IDB_NOCHECK);

5. Now map the click event to view (or dialog).
You can set the bitmaps here

m_grid.SetCellPicture (
m_picCheck.GetPictureDispatch()
)
You can also do this based on row or col number.
I am even checking what is the current bitmap in
the cell by comparing the handles.

hope this works

bye
surendra