Use C # to customize the jumplist of window7 (jump List)

Source: Internet
Author: User
Tags visual studio 2010

I believe those who have used window7 know that some new functions such as jumplist (jump list) are added to the window7 taskbar ),

This is the jumplist of IE8. Now we can use Visual Studio 2010 and C #4.0 to write code to change jumplist and custom.

First, use vs2010 to create a windowform project. net 4.0 architecture), right-click and select the reference point ference (add reference) under solution (on the right of the screen). Here we want to add two DLL file paths: C: \ Program Files \ reference assemblies \ Microsoft \ framework \. select presentationcore for netframework \ v4.0. DLL and presentationframework. DLL. Because the jumplist class is included in the two namespaces.

Reference:

Using system. Windows. shell;

Using system. IO;

 

The core code is as follows:

Private void btnadd_click (Object sender, eventargs e) {jumptask = new jumptask (); // instantiate a jumptask object jumptask. applicationpath = path. combine (environment. getfolderpath (environment. specialfolder. system), "calc.exe"); // applicationpath is the application path .. Jumptask. iconresourcepath = path. Combine (environment. getfolderpath (environment. specialfolder. System), "calc.exe"); // program icon path. Jumptask. title = "claculator"; // The title jumptask. description = "Start calculator"; // describes jumptask. customcategory = "New Micosoft Tools"; jumptask jumptask1 = new jumptask (); jumptask1.applicationpath = "http://www.cnblogs.com/xspaceworld/"; Parameters = @ "C: \ Program Files \ Internet Explorer \ iexplore.exe "; jumptask1.description = "go to X-space blog"; jumptask1.title = "xuya's blog"; Parameters = "Bolg links"; jumptask jumptask2 = new jumptask (); jumptask2.applicationpath = textbox1.text; jumptask2.iconresourcepath = textbox4.text; jumptask2.description = textbox2.text; jumptask2.title = textbox3.text; character = combobox1.text; jumplist = new jumplist (); jumplist. jumpitems. add (jumptask); jumplist. jumpitems. add (jumptask1); jumplist. jumpitems. add (jumptask2); jumplist. apply ();} private void btnclear_click (Object sender, eventargs e) {jumplist jumplist1 = new jumplist (); jumplist1.jumpitems. clear (); jumplist1.apply ();} private void btnopen_click (Object sender, eventargs e) {If (openfiledialog1.showdialog () = dialogresult. OK) {textbox1.text = openfiledialog1.filename;} private void button2_click (Object sender, eventargs e) {openfiledialog1.filter = "ICO | *. ICO | exe | *. EXE "; if (openfiledialog1.showdialog () = dialogresult. OK) {textbox4.text = openfiledialog1.filename; picturebox1.image = image. fromfile (openfiledialog1. filename) ;}} private void form1_load (Object sender, eventargs e) {combobox1.items. add ("Bolg links"); combobox1.items. add ("New Micosoft Tools"); combobox1.selectedindex = 0 ;}

Some improvements are needed ..

For example, if you want to add a list, you can directly call this list to add the previous content. Now, you can only add one. Experts can give more advice and communicate with each other.

:

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.