How can I avoid that the formatting of the destination cells is changed, when I copy and paste or drag and drop cells in the grid. I only want to copy the text values.
You can specify GX_DNDTEXT when you call EnableOleDataSource and also when you register the grid as drop target.
Example:
int CMyGridView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CGXGridView::OnCreate(lpCreateStruct) == -1)
return -1;
#if _MFC_VER >= 0x0400
// Enable grid to be used as data source
EnableOleDataSource(GX_DNDTEXT);
// Register the grid as drop target
VERIFY(m_objDndDropTarget.Register(this, GX_DNDEGDESCROLL | GX_DNDAUTOSCROLL | GX_DNDTEXT));
- Or - (for clipboard setting only)
m_nClipboardFlags = GX_DNDTEXT;