download url: http://www.4sea.org/temp/test-combo.rar 
3kb
現在用另外一種方法替代解決, 但是任務攔回條出一個窗口,每次按combobox都會,所以得替換,
我寫了個上面的測試程序, 沒有窗口了, 但是picture的位置老是不對.
請大家幫我看看, 還有作測試的時候, 在父窗口多改變幾下UserControl11的位置.

解决方案 »

  1.   

    還有,如何真真模擬combox, 比如在picture1顯示出來後,我按了父窗口的其他地方,picture1就隱藏了.
      

  2.   

    Dim hWndDesktop As Long
      Dim iLeft As Long
      Dim iTop As Long
      If Picture1.Visible = False Then
        Picture1.Visible = True
        UserControl.Width = 3015
        UserControl.Height = 2000
        
        Picture1.ZOrder (0)
        Set m_ParentControl = txtMain
        SetParent Picture1.hWnd, Parent.hWnd
    '    GetWindowRect Parent.hWnd, sRect
    '    GetWindowRect txtMain.hWnd, sRect1
    '    iLeft = sRect1.Left * 15
    '    iTop = sRect1.Bottom * 15
    '    Picture1.Left = iLeft
    '    'Picture1.Left = sRect1.Left - sRect.Left
    '    'Picture1.Top = sRect1.Top - sRect.Top + 350
        
        Dim ctlTemp As Control
        Dim i       As Integer
        
        With UserControl.ParentControls
            For i = 0 To .Count - 1
                'Ambient.DisplayName = .Item(i).Name
                If Err.Number <> 0 Then
                    Err.Clear
                ElseIf UserControl.Ambient.DisplayName = .Item(i).Name Then
                    Set ctlTemp = .Item(i)
                    Exit For
                End If
            Next i
        End With
        
        Picture1.Left = ctlTemp.Left + ctlTemp.Width
        Picture1.Top = ctlTemp.Top
        
      Else
        Picture1.Visible = False
      End If
      

  3.   

    厲害, roger_xiong(卖女孩的小火柴~) 你幫助了我不少阿.