简体   繁体   English

Word中的左键单击事件

[英]Left Click Event in Word

I need to know if there is any possibility to create a completely new event or may I'm blind and there is one... 我需要知道是否有可能创建一个全新的活动,或者我是盲人,有一个...

Exactly I have a button in my word ribbon > after a click on it the user should click anywhere in the document to create a richtextbox (the windows.forms) and for this I need the click position. 确实,我的文字功能区中有一个按钮>单击该按钮后,用户应该在文档中的任何位置单击以创建一个RichTextBox(windows.forms),为此,我需要单击位置。

It seems that there is no such event in a Word add-in. 似乎在Word加载项中没有此类事件。 See: Mouse Events in Word 2010 application level AddIn 请参阅: Word 2010应用程序级别外接程序中的鼠标事件

As mentioned in that post, the use of WinApi could be an approach. 如该帖子所述,使用WinApi可能是一种方法。

Or maybe the "Document.SelectionChange Event" could help with this problem. 也许“ Document.SelectionChange事件”可以帮助解决此问题。

I solved my problem with a TextBox over the whole page. 我用整个页面上的TextBox解决了我的问题。 With this Box I created a click event and so i got the exact position. 通过此框,我创建了一个点击事件,因此我获得了准确的位置。 I know this isn't the best possibility but it worked for me. 我知道这不是最好的可能性,但是对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM