In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how the Visual Studio.NET plug-in works. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
I will start with the object browser (ObjectBrowser), because it is very easy for us to learn objects, so he is a very good assistant. You can right-click on the object you want to view and select go to GoToDefinition to view the members of the class. You can view the prototype of any of the listed members, or select a member to access the first help by pressing F1. The applicationObject object describes the VisualStudio.NET plug-in hosting (host) application, in this case the host application is VisualStudio.NETIDE. ApplicationObject is implemented in the OnConnection method. Find "DTE" in the online help, and even declare the variable applicationObject of type "_ DTE" in the code automatically generated by the wizard. You will see many interesting members of her at the application level.
One of the members is the ActiveDocument property (property), which describes the document in focus (document). This document is the document for which you want to InsertDate. In cases where window focus and document focus are related but different, a very useful rule is that documents with focus will be saved regardless of whether the form has focus or not.
The ActiveDocument.Selection property returns an object that describes the current selection in the document. Because it is a normal object in C #, I force it to convert to TextSelectioni. ActiveDocument is an ordinary class, because document does not need to be based on text, just like a form design document. People who have studied VC++ may be familiar with the inheritance of document classes, and those who are not familiar with them can read books on the subject. As a result, the Selection property is also a normal class, and here I cast it into the TextSelection type that we actually operate on in the class.
TextSelection describes a view of a file (view), and the actions and tools of the file | the settings in the options are also used. It provides a lot of properties and methods that you might think of to modify the file, as well as the view he can influence to use (view), the current selection, and the insertion location. If you have ever recorded a macro, you can see that the TextSelection object is used to capture the content. InsertDate simply sets the value of the Text property to the current date. Like Text, all actions can be set to the same type of value. This means that all the resulting content will be replaced, and if no content is selected, it will be replaced at the position of the cursor, but you should pay attention to whether the current state is insert or override mode.
Another method is to use the Insert function, which allows you to control where the text is placed and describes an action that cannot be redone. Using this method to replace the Text attribute to specify the insert is as follows:
(TextSelection) applicationObject.ActiveDocument.Selection) .Insert (DateTime.Now.ToString ("yyyy-MM-dd"), (int) EnvDTE.vsInsertFlags.vsInsertFlagsCollapseToEnd)
This vsInsertFlags indicates how and where the text has been inserted. The documentation for vsInsertFlags was ignored in the online help group, so I included this section.
This is the end of this article on "how the Visual Studio.NET plug-in works". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.