在 VB6 標準菜單欄的下拉選單中嵌入可編輯/可選的 ComboBox 控件,以實現類似「字體大小」、「縮放比例」等即時輸入選擇交互。
ToolBar 控件;Style = tbrButtonDropDown;ButtonClick 事件中彈出自定義菜單(PopupMenu),菜單項可包含文本框、ComboBox 等 ActiveX 控件容器;SetParent API 將 ComboBox 父窗口設置為菜單彈出窗口句柄,實現視覺融合。使用 Menu Editor 創建擁有 OwnerDraw = True 的菜單項,在 MeasureItem/DrawItem 事件中手繪下拉框外觀,並在 Click 事件中動態創建一個無邊框 Form 模擬下拉列表。此法靈活度高但開發工作量大,需自行處理鍵盤導航、焦點切換、滾動條等細節。
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
ToolStripControlHost 原生支持;