共用方式為


CComboBox::DeleteItem

呼叫框架,當使用者從主控描繪 CComboBox 物件中的項目或終結下拉式方塊。

virtual void DeleteItem( 
   LPDELETEITEMSTRUCT lpDeleteItemStruct  
);

參數

備註

這個函式的預設實作不執行任何動作。 覆寫這個函式會繪製下拉式方塊的需要。

範例

// CMyComboBox is my owner-drawn combo box derived from CComboBox. This  
// example simply dumps the item's text. The combo box control was  
// created with the following code: 
//   pmyComboBox->Create( 
//      WS_CHILD|WS_VISIBLE|WS_BORDER|WS_HSCROLL|WS_VSCROLL| 
//      CBS_SORT|CBS_OWNERDRAWVARIABLE, 
//      myRect, pParentWnd, 1); 
// 
void CMyComboBox::DeleteItem(LPDELETEITEMSTRUCT lpDeleteItemStruct) 
{
   ASSERT(lpDeleteItemStruct->CtlType == ODT_COMBOBOX);
   LPTSTR lpszText = (LPTSTR) lpDeleteItemStruct->itemData;
   ASSERT(lpszText != NULL);

   AFXDUMP(lpszText);
}

需求

Header: afxwin.h

請參閱

參考

CComboBox 類別

階層架構圖表

CComboBox::CompareItem

CComboBox::DrawItem

CComboBox::MeasureItem

WM_DELETEITEM