I posted blog entry about how to show image in grid based on control source in last month. I received few comments/emails and inform me that my sample is not working.

First of all, thank you for your interest of reading my blog. OK, I read my previous blog again and agree that my explanation is not clear enough. I miss out some steps to mention. I repost it here with sample attached.

1. Create new class (CREATE CLASS ?)

2. Place an image control on the container class. Adjust image position accordingly. (Set Image.anchor = 15 if using VFP9). Set mycontainer.backstyle = 0 - Transparent, mycontainer.borderwidth = 0, myimage.backstyle = 0 - Transparent.

3. Select container object, select “Edit Property/Method …” from menu as shown below.

4. Edit Property/Method dialog form will be shown. Select BackStyle from the list and check “Assign Method” and “Access Method” checkbox and click Apply.

5. Open mycontainer.backstyle_access method and put your code.

6. Save your class.

7. Create a form, place your grid control and place mycontainer class into column. (Remember to delete the existing column.textbox control).

8. Set column.sparse = .F.

9. Add your code to open table/create cursor.

10. Set "mycursor.cimage" to grid.column1.controlsource; "mycursor.cdescr" to grid.column2.controlsource.

11. Save your form and run it.

Do you get the same result?

Technorati tags: , ,