Not sure what you are seeing when ;it does not work'
I just put together an OCX that does this.
The usercontrol has background set to transparent.
To keep thing simple, I dont have much in the resize, but you need to have the control large enough to display the expanded listbox, no matter what the user thinks the size should be.
So I dont think it makes sense to size the button to match the control area.
Here is the code behind my simple control.#
It contains a button called Drop, and a list called List, which shows maybe 6 rows of data.
List is initially visible = false.
When drop is clicked, the list will appear and disappear. It will appear over any controls placed under the user control, and the area underneath the drop button will not be erased when the list is shown.
Private Sub Drop_Click()
Showhide
End Sub
Private Sub Showhide()
List.Visible = Not List.Visible
End Sub
Private Sub UserControl_Resize()
drop.Move UserControl.ScaleWidth - drop.Width, 0 'button to the right
UserControl.Height = List.Height + 60 'keep big enough to show the list
End Sub
Enter your message below
Sign in or Join us (it's free).