VSTO: Drawing on top of Excel worksheet

梦想的初衷 提交于 2019-12-10 19:34:02

问题


I've written a bunch of handy Excel add-ins in C#, and everything works great. But the one thing I haven't been able to figure out is if it's possible to place graphics (bitmaps, shapes, whatever) on a worksheet control, e.g. by appending a function to its paint event handler.

I don't want to actually change the document in any way, it's only for temporarily highlighting things to indicate how my add-ins are finding and interpreting data in the sheet. The simplest thing I want to be able to do is draw a border around a specific range.

I could do it by creating a bunch of transparent top-level windows that try to clip themselves to the document window, but that's really a nasty solution, and I'm thinking the windows would get in the way of user input, too.


回答1:


It's late answer, but for future readers I think it's worth to clarify. There is no way to use paint event to draw anything on the top of Excel. But there is built in way to highlight a range or many ranges at the same time - just select it from code.



来源:https://stackoverflow.com/questions/5952032/vsto-drawing-on-top-of-excel-worksheet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!