Hello, I have worked quite a while with the datagrid control for now and I was able to create custom columns that format the text and the appearance, that display a combo box or other drop-down controls. However, I am stuck at the next level: replacing all TextBox'es that correspond to a DataGridTextBoxColumn with a different control, for example a button. To replace with a combo box is easy because I have just one combo box and I display it on the Edit Event wherever the current cell is. But to display buttons is different.

I tried an approach but I am sure it is far from the best: in the Paint event I use DrawButton to draw a button unpushed or pushed (as shown by a variable that holds the pushed button by row). Then in the Grid's OnMouseDown/OnMouseMove/OnMouseUp I try to handle the button's appearances similar to how windows does (for example if you press the button and then you hover without releasing the mouse outside the button the button returns to it's state). But this is so clumsy and because of that a lot of obvious refreshing flicker happens, and also the fact that I have to completely remove the Edit event (to be able to draw the buttons when cliecked) there is no way to catch any event in the TextBox...

Does anybody know any method more elegant and more reliable to do this? As a matter of fact I think that once I am able to "replace the TextBox" with a button, I can basically replace it with ANY other control... But my method is far from being a generalization... au contraire...

I am wondering if there is a way to "override" the creation of the textbox itself and replace it with another control's creation?

Any help would be appreciated,

thank you,
iulian