I am trying to display some text with features and I have created a new C++ class that implements the IFeatureRenderer to do this. In the Draw method, I access additional fields from the features found by the FeatureCursor and I explicitly call display->DrawText to display up to 6 text strings where I want and with the necessary size and color. Because I am using an inMemoryWorkspaceFactory, I cannot use the standard annotation features. Other text approaches that I have taken, don't seem to work well, including dynamic display layers.
My problem is that when I call IScreen->Invalidate() to force ArcEngine to redisplay specific areas, the spatialQuery that is used to find the features that need to be refreshed, don't always find the features associated with the text that I am drawing. Therefore the screen is left blank where some of the text is normally drawn.
I have thought about extending the IFeatureClass with IFeatureClassExtensions but I don't think that will solve the problem since the spatial query is using the shape stored in the feature class.
I could try to change the geometry stored in the feature class to be a simple rectangle that contains the bounding box of my text but the text is drawn at a constant size, so the geometry will grow or shrink based on the zoom level. That would mean that on every zoom, I would need to recalculate each feature's bounding box which seems very inefficient.