VSTO:借鉴Excel工作表的顶部 [英] VSTO: Drawing on top of Excel worksheet
问题描述
我已经用C#编写一堆方便的Excel插件,并且一切都很正常。但有一件事我一直没能搞清楚的是,如果有可能放置图形(位图,形状,等等)工作表上的控制,例如通过附加到其Paint事件处理程序的功能。
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.
我不希望以任何方式实际上改变文档,这只是暂时突出的东西,表明如何我添加-INS发现并在片材解释数据。我希望能够做最简单的事情就是周围画一个特定范围的边界。
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.
推荐答案
这是迟到的答案,但对于未来的读者,我认为这是值得澄清。有没有办法用油漆事件吸取的Excel中的任何东西。但有内置的方式突出在同一时间的范围或多个范围 - 从代码只是选择它
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.
这篇关于VSTO:借鉴Excel工作表的顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!