主题:各位高手,这段VC的代码怎么转BCB的?
这是VC的范例,在BCB里source要改一下:
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// Some other custom source code here
m_RadioListBox.SubclassDlgItem(IDC_RADIOLISTBOX, this);
return TRUE; // return TRUE unless you set the focus to a control
}
void CRadioListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
// just draws focus rectangle when listbox is empty
if (lpDrawItemStruct->itemID == (UINT)-1)
{
if (lpDrawItemStruct->itemAction & ODA_FOCUS)
pDC->DrawFocusRect(&lpDrawItemStruct->rcItem);
return;
}
else
{
int selChange = lpDrawItemStruct->itemAction & ODA_SELECT;
int focusChange = lpDrawItemStruct->itemAction & ODA_FOCUS;
int drawEntire = lpDrawItemStruct->itemAction & ODA_DRAWENTIRE;
if (selChange || drawEntire)
{
BOOL sel = lpDrawItemStruct->itemState & ODS_SELECTED;
// Draws background rectangle, color depends on transparency
pDC->FillSolidRect(&lpDrawItemStruct->rcItem,
::GetSysColor((GetExStyle()&WS_EX_TRANSPARENT)?
COLOR_BTNFACE:COLOR_WINDOW));
// Draw radio button
int h =
lpDrawItemStruct->rcItem.bottom - lpDrawItemStruct->rcItem.top;