Change programming for the Visual Studio "latest project" list

Source: Internet
Author: User

Oh, my God, it's miserable! I wrote a long article on the browser, because the upload of an image server did not respond, causing the previous work to be destroyed. In the past, it was dangerous to write something on a browser. Today I am lucky enough to learn and dare not do anything!

To put it bluntly: Let's take a look at the program interface:

Source program:Http://download.csdn.net/source/1957681


Anyone who has used Visual Studio. NET and later IDE development tools must know the one in Visual Studio. "Start page"And the one on the "start page" "Recent Project". Good! The "recent project" contains the recently created and opened project files, which provides a good way to quickly open a project, avoid turning left and right to find the project path in the file system. However, I always feel that this "recent project" is not well done in some places. For example: 1. Sometimes, in order to seek some help to open others' projects or their previous projects, such uncommon projects will be saved in the "recent projects" list, occupy limited resources. (The bar space of the "recent project" is just a little bit, but it cannot be displayed. And it seems that there is no way to scale it out. I didn't find a way anyway ). 2. Sometimes, when a project is finished, it is still there every day, as if it is showing off itself. It is also a waste of resources. 3. methods provided in Visual Studio (or not found) to delete the items in the recent project. Based on the above considerations, I want to manage the "recent project" list by myself.First, I rummaged through the computer to find the hiding place of the latest project. Finally, Google told me that the project list is hidden in the HKEY_CURRENT_USER/software/Microsoft/visualstudio/9.0/projectmrulist subkey of the Registry (taking Visual Studio 2008 as an example ). The key value is the complete path of the project file. In this way, I can increase or decrease the Registry to control the list of "recent projects. After several times, I found that this method was too difficult. I had to find the registry from top to bottom each time, and then delete some. Trouble !!! So I want to compile a small program to control the modification and addition of the Registry.It is not difficult to write a program to control the registry using C #, As long as "using Microsoft. win32; "use the registry and registrykey classes. Read the registry and display the list in the datagridview) move, add, and delete the operation list and save it to the Registry to change the "latest project" list. The program focuses on the following: 1. Read the registry.For more information about the registrykey class, SEE region: Statement:Code:
  1. Registrykey key = registry. currentuser. createsubkey ("software // Microsoft // visualstudio ");
Method: Code:
  1. Key. getsubkeynames (); // obtain the names of all subkeys under the key. This method returns a String Array (string []).
  2. Key. getvaluenames (); // obtain the names of all items under the key. This method also returns a String Array (string []). This method is used to read the project list.
  3. Key. setvalue ("file" + (I + 1 ). tostring (), datagridview1 [1, I]. value. tostring (), registryvaluekind. expandstring); // set (create. There are many parameters in this method, and there are several reload formats. The meanings of the parameters used for reload formats are: item name, data, and registry type.
  4. Key. deletevalue (keynames [I], false); // delete an item. The parameters are respectively the item name, indicating whether an exception is thrown if the specified value cannot be found.
  5. Key. Close (); // close the opened registry after use.
2. Modify the row (rows) of the datagridview ).This involves adding data to the dview datagriand performing the top, bottom, up, move down, and delete operations on a row. You can also add a new row. You can add data to the datagridview using the following methods:Code:
  1. Datagridview1.rows [N]. setvalues (item); // here n is the ordinal number of rows, and item is the object [] type variable. For more information, see the complete project file I uploaded.
  2. Datagridview1 [column, row]. value = "string ";
  3. Datagridview1.rows [row]. cells [column]. value = "string ";
The preceding two methods are equivalent, namely, setting individual cells. Row indicates the row sequence number and column indicates the column sequence number. Operate on rows. The operation is performed on the basis of modifying rows. It is nothing more than declaring a cache variable and reverse the content of several related rows. I will not talk about this process here. If you are interested, you can take a look at the source program. When you operate the row of the datagridview, Note thatThat is, the rowcount attribute of the datagridview. During the operation (mainly adding), you must always operate the rows within rowcount; otherwise, an exception is thrown. To make the rowcount of the datagridview rowalways equal to the number of projects, you must remember to perform the rowcount --; Operation When deleting the project. This is a strange phenomenon: when the last row in the election is used to perform the delete operation, after rowcount --;, the last row of data is always deleted, and the last row is supplemented. The reason for debugging has not been found many times. Maybe this is the design of the datagridview. No matter what, I also used a seemingly unconventional method to solve this problem, that is, when the last row is deleted, in rowcount --; previously, the value of the last row is also assigned to the value of the last and second rows. The last two values are the values of the last and second rows. No matter which one you delete, the final result is the same. The problem is solved. 3. Determine the versions of Visual Studio on the computer based on the registry.The version number (9.0) recorded in the registry (HKEY_CURRENT_USER/software/Microsoft/visualstudio/9.0/projectmrulist) is determined here. I searched the internet and found that the correspondence between the version number and the Visual Studio version is as follows:
Visual Studio version correspondence
Version Number Version
10.0 Microsoft Visual maxcompute 2010
9.0 Microsoft Visual maxcompute 2008
8.0 Microsoft Visual maxcompute 2005
7.1 Microsoft Visual Studio. NET 2003
7.0 Microsoft Visual Studio. NET (1, 2002)

I compile the program based on such a relationship. If any of the above mappings are wrong, please remind me.
All right, there is no difficulty for the rest after solving these three problems.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.