简体   繁体   中英

c++ win32 create a text only button

I would like to add a simple text button to my c++ win32 application. I'm creating the button using CreateWindowEx function, but can't figure out the correct style to do so. I would like to display a text only button and be able to recive messages when the user clicks on it. The style i would like to get is identical to the text button in windows 7 system volume control (where it says "Mixer"). If possible i would like to display a tooltip also.

在此输入图像描述

That mixer control looks more like a hyperlink control than a button. I'd go for the SysLink control if that's what you need.

You could create a "Button" class window with the BS_OWNERDRAW style and handle the WM_DRAWITEM messages. In your WM_DRAWITEM message handler you can simply display the text.

Actually that button is an owner draw button - it listens to mouse move messages and when you hover over it, it underlines the text (the syslink control doesn't have this behavior). Otherwise it's a stock button.

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