On high DPI displays, the MFC ribbon control shows tooltips at a surprisingly narrow width. This is because there is nothing to account for the DPI and scaling of the display. Fortunately, with a little bit of code during ribbon initialization, this can be mostly fixed.

This is not perfect because tool tips that display short lines will show up at the new fixed width. This might be fine and might even be how the tips normally display (I don’t want to undo my code, change display scaling, etc., just to test out the normal behavior). The code sets the max using the tooltip manager, which doesn’t seem to have the ability to control the size of tips that don’t contain images. It then sets the fixed width of the tooltips using the ribbon control. Note that I use the same width for with and without large images because the MFC code has hard-coded values and I don’t want to dig deeper when the same number works fine for both.

The code has a few lines that have nothing to do with the tooltip issue. I left them in due to my being lazy. Also notice that the code will get the default max width from the tool tip manager and use that as the basis for the tip sizes. This seems to work fine on my 2.5x DPI scaled display.

And somehow during updating my blog, the code line numbers became screwed up relative to the code. I haven’t gotten to fixing it after initially trying and failing. Sorry.