⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 00000016.txt

📁 水木清华BBS站的讨论区精华集锦
💻 TXT
字号:
 
                       --===BBS水木清华站∶精华区===--
 
                        -===BBS水木清华站∶精华区===-
   _____________________________________________________ 
   How subclass the listbox portion of a combobox? 
   _____________________________________________________ 
  
   The listbox portion of a combobox is of type COMBOLBOX  ( notice the 
 'L'). 
 Because the ComboLBox window is not a child of the ComboBox window, it is 
 not obvious how to subclass the COMBOLBOX control.  Luckily, under the 
 Win32 
 API, Windows sends a message to the COMBOBOX ( notice no 'L') called 
 WM_CTLCOLORLISTBOX before the listbox is drawn. The lParam passed with this 
 message contains the handle of the listbox. For example: 
  
 LRESULT CFileUpdateCombo::OnCtlColorListBox(WPARAM wParam, 
  
 LPARAM lParam) 
  
 { 
  
         if ( ! m_bSubclassedListBox ) 
  
 { 
  
                         HWND hWnd = (HWND)lParam; 
  
                         CWnd* pWnd = FromHandle(hWnd); 
  
                         if ( pWnd && pWnd != this ) 
  
                         { 
  
                                 // m_ListBox is derived from CListBox 
                                 m_ListBox.SubclassWindow(hWnd ); 
  
                                 m_ListBox.SetOwner(this); 
  
                                 m_bSubclassedListBox = TRUE; 
  
                         } 
  
         } 
  
         return (LRESULT)GetStockObject(WHITE_BRUSH); 
  
 } 
 
                        -===BBS水木清华站∶精华区===-

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -