简体   繁体   中英

Creating an OS close button? (WinAPI)

I want to create a button that is basically Windows' close button. How could I do this? I want to avoid drawing this myself because I want it to look like that version of Windows' close button. Firefox's tabs do something like this. Thanks

You can get at Windows XP+ theme specific UI elements via the DrawThemeBackground API.
Use WP_CLOSEBUTTON for the window X button (and one of CBS_NORMAL/HOT/PUSHED/DISABLED for its state) and you can draw one wherever you like.

The close buttons on the tabs in Firefox are part of its theme.

If you look in Program Files\\Mozilla Firefox\\chrome\\ there's a zip file called classic.jar.

Inside this zip file is a png file skin\\classic\\global\\icons\\close.png.

This png file has the icons for the various states of the close buttons on the tabs:

替代文字 from hg.mozilla.org

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM