How to implement a beautiful menu on the tray icon

xiaoxiao2021-03-06  20

Today, I saw a post. Q: How to implement the picture effect on the left side of the menu in the Window Start menu in the tray icon implementation. So I did one. My idea is not using a menu, implemented with a form (I think not only Delphi other programming languages ​​should be the same). In the example, I used a third-party control: TRAYICON used to display the dynamic tray icon (download address: http://2ccc.com/Article.asp? Articles = 1985). Please see the following steps: 1. Create a project, establish two forms of form1 and iconform. The second one is used to display the tray icon menu. 2. Place a TRAYICON, ImageLIST, and ApplicationEvents controls on Form1. 3. Add appropriate icons to ImageList, then associate ImageList in the ICON item in Trayicon's Properties Editor. (If you join multiple icons, you can set the TRAYICON's Animate to True, you can see the dynamic icon, Demo in the TRAYICON control package) 4. Set the TRAYICON's PopupMenuon property to IMNONE; Visible is set to true. 5. Write in Trayicon's mouseup event: var apoint: tpoint; begin getcursorpos (apoint); if (screen.activeform <> nil) and (screen.activeform.handle <> 0) THEN SETFOREGROUNDOWINDOW ;

If Iconform.Width apoint.x <= screen.width then iconform.left: = apoint.x else iconform.left: = apoint.x - form2.width;

iconform.top:=apoint.y - form2.height; iconform.show; end; 6. Write in the deActivate event in ApplicationEvents: iconform.close; 7. Place two tabs on the iconform Label_Restore, label_exit 8. In Iconform DEACTIVATE Event Write: Close; 9. Write in the Click event of Label_Restore; form1.trayicon1.restore; written in Label_exit's Click event: Application.Terminate; 10. He'ute, programming work has been completed, click on the pallet icon How is the effect. You can do things you want to do in iConform, don't say pictures, you can do it on Form.

If you have better ways or ideas, welcome to discuss: QQ: 56059327, MSN: kerm@hotmail.com. Thank you!

转载请注明原文地址:https://www.9cbs.com/read-43713.html

New Post(0)