VSTO: drawing on top of Excel sheet

I wrote a bunch of handy Excel add-ins in C # and everything works fine. But one thing that I could not figure out is the ability to place graphics (bitmap images, shapes, etc.) on a work line control, for example. adding a function to your paint event handler.

I don’t want to modify the document in any way, it’s only to temporarily highlight things, to indicate how my add-ons find and interpret data on the sheet. The simplest thing I want to do is draw a border around a certain range.

I could do this by creating a bunch of transparent top-level windows that try to pin themselves in the document window, but this is a really nasty decision, and I think the windows will interfere with user input, too.

+3
source share
1 answer

This is a late answer, but for future readers I think it’s worth clarifying. You cannot use the draw event to draw anything at the top of Excel. But there is a built-in way to highlight a range or multiple ranges at once - just select it from the code.

0
source

All Articles