C # implement the "add control" button on the taskbar,

Source: Internet
Author: User

C # implement the "add control" button on the taskbar,

Use of Windows7Taskbar

Bytes

: Http://yunpan.cn/QauRaNK4H3BYW (extract code: fe58)

Encapsulated classes: Windows7Taskbar, ThumbButtonManager, ThumbButton, JumpListManager, RegistrationHelper, etc.

Windows7Taskbar is used for registration and initialization. ThumbButtonManager manages ThumbButton, including the create button, JumpListManager history, and RegistrationHelper associated file type.

Steps:

1. Reference

Using windows7.20.topintegration;
Using windows7.20.topintegration. WindowsForms;

2. Initialization (when loading the form)

Windows7Taskbar. AllowTaskbarWindowMessagesThroughUIPI ();
Windows7Taskbar. SetCurrentProcessAppId ("TaskbarManaged"); // you can customize the parameters.

3. Create button

ThumbButtonManager buttonManager = this. createThumbButtonManager (); ThumbButton taskbarBtnPause = buttonManager. createThumbButton (101, Properties. resources. playtask, "play"); taskbarBtnPause. clicked + = (sender, e) =>{ btnPlay_PictureClick (sender, e); if (IsPlay = true) // check whether the video is being played. Update the icon {taskbarBtnPause. icon = Properties. resources. playtask;} else {taskbarBtnPause. icon = Properties. resources. pausetask ;}
};
ButtonManager. AddThumbButtons (taskbarBtnPause );

4. capture information

protected override void WndProc(ref Message m)
{  if (buttonManager != null)   buttonManager.DispatchMessage(ref m);  base.WndProc(ref m);
}

:

Note that:

A maximum of seven buttons can be added or deleted. After initialization, you can only make them unavailable or hidden. You can call the ThumbBarAddButtons and ThumbBarUpdateButtons methods to control the toolbar.

Adding ThumbButton during the Load time of the form does not work, which is why I did not add ThumbButton when loading the form, and each ThumbButton has an ID, which is assigned by you, it cannot be repeated.

Problems:

I added a Processing Event to taskbarBtnPause. Clicked, that is, the change Icon. The result is that the ThumbButton attribute Icon is modified when the event is triggered, but the interface is not updated.

 

Address: http://www.cnblogs.com/liuxiaobo93/p/3914424.html twilight ice blue

 


C language ^ how to use

A1 = 0x01; // 0000 0001
A2 = 0x00; // 0000 0000
A3 = 0x03; // 0000 0011
A4 = 0x02; // 0000 0010

B1 = a1 ^ a2; // 0000 0001
B2 = a1 ^ a3; // 0000 0010
B3 = a1 ^ a4; // 0000 0011

^ XOR operator. The bitwise value is 0 and the difference is 1. See the example above.

//
Examples of simple and practical problems:
====================================
======= A ======= B =========
There are two circuits on the top. The two switches are a and B respectively. The opening status is \ [1], and the closing status is/[0].
If both circuits are enabled or disabled.
If a turns on [1], B turns off [0], and circuit 1 Powers on
=====================
If a disables [0], B enables [1], and circuit 2 powers on.
====================================
In summary, the circuit fails in the and B states simultaneously [0]. When a and B are different, the power is charged [1].

C language ^ how to use

A1 = 0x01; // 0000 0001
A2 = 0x00; // 0000 0000
A3 = 0x03; // 0000 0011
A4 = 0x02; // 0000 0010

B1 = a1 ^ a2; // 0000 0001
B2 = a1 ^ a3; // 0000 0010
B3 = a1 ^ a4; // 0000 0011

^ XOR operator. The bitwise value is 0 and the difference is 1. See the example above.

//
Examples of simple and practical problems:
====================================
======= A ======= B =========
There are two circuits on the top. The two switches are a and B respectively. The opening status is \ [1], and the closing status is/[0].
If both circuits are enabled or disabled.
If a turns on [1], B turns off [0], and circuit 1 Powers on
=====================
If a disables [0], B enables [1], and circuit 2 powers on.
====================================
In summary, the circuit fails in the and B states simultaneously [0]. When a and B are different, the power is charged [1].

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.