VC Set the dialog box background picture is not properly displayed radio control transparent

Source: Internet
Author: User
Create a dialog box item in VC2005, add a radio button, and then set the OnCtlColor dialog box in the background image as follows:

Ctestbrushdlgdlg::ctestbrushdlgdlg (cwnd* pparent/*=null*/)
: CDialog (Ctestbrushdlgdlg::idd, pparent)
M_hicon = AfxGetApp ()->loadicon (IDR_MAINFRAME);
M_nullbrush.createstockobject (Null_brush);
CBitmap Bitmap;
Bitmap. LoadBitmap (Idb_backup);
M_brush. CreatePatternBrush (&BITMAP);

Hbrush Ctestbrushdlgdlg::onctlcolor (cdc* PDC, cwnd* pwnd, UINT nCtlColor)
Hbrush HBR = Cdialog::onctlcolor (PDC, pwnd, nCtlColor);
Todo:change any attributes to the DC here

if (nCtlColor = = ctlcolor_static)
Pdc->setbkmode (Transparent);
return m_nullbrush;

Return (Hbrush) (m_brush.m_hobject);

1. When setting the project "Character set" to "use Unicode Character set", this radio background is the entire picture, not transparent.
2. When setting the project "Character set" to "use Multi-Byte Character set", the display is normal.

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: 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.