[C #] balloontip that can be displayed anywhere

Source: Internet
Author: User
Balloontip usually appears on the icon in the lower-right corner of the screen, such as the bubble prompt when you plug or remove the USB device. This function is located in shell32 and is implemented by calling the following API function: bool shell_policyicon (DWORD dwmessage, ppolicyicondata lpdata). This function is used to control trayicon and a balloontip is displayed. However, it can only be limited to the tray position. In the QQ chat dialog box, we found that if you try to send a message without entering the content, such a tip will pop up on the button. Therefore, I wrote a similar window in C #, which can be surfaced at any location. The effect is as follows:
 
 

This is a testProgram. In implementation, I slightly referred to the process of simulating MSN surfaced windows on codeproject.Code. The main trouble involved is how to handle the layout of elements in the window to provide flexible enough interfaces. For the sake of simplicity, only the layout of the arrow in the lower right corner is provided. (Obviously, this arrow can have a total of eight dock locations ).
(1) In the pop-up, do not take away the focus of other windows. Therefore, the showwindow function of the API is used: showwindow (this. Handle, sw_shownoactivate );
(2) The form contains four main items: icon, title, content text, and close button. Users can configure them. For example, they can select an icon (which can be set externally or using a built-in icon), whether to display the close button, and whether to automatically close it (if the timeoutmilliseconds attribute is set to a negative number, it will not automatically close, can only be closed through closebutton), various colors, fonts, etc. A balloonclick event is provided to notify external users of click events.
(3) When drawing a closebutton bitmap, because the figure has a transparent color, you need to specify a transparent color during painting, which is equivalent to the mask. Otherwise, the transparent color will be drawn to the form, causing the form to be transparent.
(4) This window is displayed, mainly using the showat () function. Some parameters are required. You can set other attributes separately.

Source codeDownload link:
Http://files.cnblogs.com/hoodlum1980/JDL.UILib_BalloonTip_VS7.rar

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.