Search code examples
visual-c++mfcpropertygrid

How to force CMFCPropertyGridCtrl to refresh after adding an item?


I add an item to the CMFCPropertyGridCtrl, but the new item does not show up only if i click the CMFCPropertyGridCtrl.

Now i have a indirect solution to show up the new item by calling ExpandAll(), but i don't want to expand those i have collapsed.

Is there a way to show up the new item gracefully ?


Solution

  • After CMFCPropertyGridProperty.AddSubItem() call, new item will show up by the following two calls:

    YourGridCtrl.AdjustLayout();
    YourGridCtrl.RedrawWindow();
    

    Hope it helps !