cbutton

C++ MFC button disappears at window resize

若如初见. 提交于 2019-12-24 15:51:25
问题 I have a Dialog in MFC C++ that has a CButton attached. I want to modify OnSize() so that the button will anchor to bottom-left. if (btn.m_hWnd) { CRect winRect; GetWindowRect(&winRect); int width = winRect.right - winRect.left; int height = winRect.bottom - winRect.top; int x = width - wndWidth; int y = height - wndHeight; CRect rect; btn.GetWindowRect(&rect); rect.left += x; rect.top += y; btn.MoveWindow(&rect); ScreenToClient(&rect); btn.ShowWindow(SW_SHOW); } x and y are the difference of

c++ - mfc / want to add bitmap to cbutton. CButton has no member setBitmap and BM_SETIMAGE is also not available for sendMessage

那年仲夏 提交于 2019-12-11 12:27:14
问题 this is my first question on stackoverflow and i hope i do everything right:S As described in my titel i am working on a visual studio(2012) project with mfc. I try to add a bitmap to my cbutton, which was inserted in the design view to my dialog. All post i've read about this, describe to use setBitmap or sendMessage to do so. I always try to do this in the onInit()-function of my dialog. When i (try to) use setBitmap() like this: m_backButton.Attach (LoadBitmap (AfxGetInstanceHandle(),

How do I get the default check box images?

╄→гoц情女王★ 提交于 2019-12-11 11:46:12
问题 I'm trying to build an owner-drawn check box using CButton, but since I only want to change the text color, I'd like the check-box marks to remain the same. Is there a command that allows me to retrieve the default check box bitmaps for the platform where the program is running? (alternatively: how could I change only the text color, preserving the check box marks?) 回答1: I use UxTheme.dll to draw my custom checkbox. First I draw the check-box marks using: DrawThemeBackground passing it a

Remove white border of CButton

删除回忆录丶 提交于 2019-12-10 11:46:44
问题 How do I remove the white border on a CButton? I want to put two buttons, each having a BMP image, side by side so that they create a single image without having a white gap between, but when I overlap the two buttons I get a white border from either. I tried with DrawBorder(FALSE, TRUE); but it doesn't work. How do I get rid of it? 回答1: Try it with CBitmapButton. If I recall, it does not have any border unless you create one as part of the bitmap images. 来源: https://stackoverflow.com

OwnerDraw CButton mfc focus

喜夏-厌秋 提交于 2019-12-04 05:34:57
问题 With standard buttons if I have OK and Cancel, with default on OK and I press the right arrow the Cancel is focused and pressing enter on the keyboard the Cancel button function is called. This doesn't happen with ownerdraw buttons. If I press the right arrow the Cancel button is focused but pressing enter on the keyboard the OK button function is called. How can I have an ownerdraw button with standard behaviour? This is my class. BEGIN_MESSAGE_MAP(CFlatButton, CButton) //{{AFX_MSG_MAP