Native checkbox image generated by wx:
Scenario:
1. if you want to develop custom checkbox and radiobutton, the background color of the native control cannot be replaced with the background of the parent control. In this case, you can only develop your own custom radiobutton. if it is a custom radiobutton, there is no need for radiobutton images. At this time, the simplest thing is to make a texture by the artist, but there are also ways to avoid the need for the artist to make images, because wxrenderernative of Wx comes with it.
Okay. Check the Code:
wxRendererNative &render = wxRendererNative::Get(); const wxSize sizeCheck = render.GetCheckBoxSize(panel_); wxBitmap bitmap(sizeCheck.x, sizeCheck.y); wxMask *mask = new wxMask(bitmap, *wxBLACK); bitmap.SetMask(mask); wxImage image = bitmap.ConvertToImage(); image.InitAlpha(); wxBitmap bt(image); wxMemoryDC mDc; mDc.SelectObject(bt); render.DrawCheckBox(panel_, mDc, wxRect(0, 0, sizeCheck.x, sizeCheck.y)); //render.DrawRadioBitmap(panel_, mDc, wxRect(0, 0, sizeCheck.x, sizeCheck.y)); mDc.SelectObject(wxNullBitmap); bt.SaveFile(wxT("E:/bt.png"),wxBITMAP_TYPE_PNG);