|
-
Jan 4th, 2006, 10:01 PM
#1
Thread Starter
Hyperactive Member
Show my usercontrol "On top"
Hi,
I've used the following code to keep a form "On top" without problem.
I made a control similar to MSDatePicker and I'd like to keep it on top when
the date picker is open (right now when the date picker is placed at the
bottom of the form and opened there it will only be displayed up to the
bottom edge of the form).
Problem is that the UserControl doesn't have the .hWnd property.What can I do?
VB Code:
' Top most stuff in a module
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = 2
Private Const SWP_NOSIZE = 1
Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
' Usage:
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS
-
Jan 4th, 2006, 10:25 PM
#2
Re: Show my usercontrol "On top"
Have you tried using the .zOrder property of it?
-
Jan 4th, 2006, 10:32 PM
#3
Re: Show my usercontrol "On top"
If you add this to your Usercontrol code..
VB Code:
Public Property Get hWnd() As Long
hWnd = UserControl.hWnd
End Property
..then the hWnd should be accessible in code from the form (I think)
-
Jan 4th, 2006, 11:20 PM
#4
Thread Starter
Hyperactive Member
Re: Show my usercontrol "On top"
zOrder didn't work.
I did add hWnd property but still my control doesn't drop the bottom of my form.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|