|
-
Feb 1st, 2001, 12:24 PM
#1
Thread Starter
New Member
When most programs are resized they only let you move the border of the window until the mouse botton is let up and then the form smoothly resizes itself, but standard VB forms resize the form and update it instantly. So, when you try to add resize code in the forms resize event the whole form flickers.
Does anyone know how to delay the resize event so that you just move the border of a form until the mouse button is let up so that you don't get the flickering.
I think an API call may be needed to do this but I an not sure.
Thanks
Last edited by VBmichael; Feb 1st, 2001 at 06:24 PM.
-
Feb 1st, 2001, 07:37 PM
#2
I believe the LockWindowUpdate API function is what your looking for.
Code:
Private Declare Function LockWindowUpdate _
Lib "user32" (ByVal hwndLock As Long) As Long
-
Feb 1st, 2001, 09:02 PM
#3
Thread Starter
New Member
I tried this api call before.
I am not sure whether you understand what I want to do.
I am tring to resize a form like most MS and other programs do, example: Windows Explorer. What they do is when you click and hold on the lower right-hand corner of a window to resize it only an outline of the window moves not whole form. Then when you release the mouse button the window resizes itself into the desired size.
This is what I am trying to accomplish.
-
Feb 7th, 2001, 07:24 AM
#4
Addicted Member
Try Overriding The Form_Resize Event. I Think This Should Work.
-
Feb 8th, 2001, 10:30 PM
#5
Thread Starter
New Member
How would you override the FORM_RESIZE Event?
-
Feb 10th, 2001, 03:47 AM
#6
Odd. My VB projects only show the outlines. Maybe you have some additional software added to VB to make it do that.
-
Feb 11th, 2001, 02:13 AM
#7
Addicted Member
Did I Tell Override, Just Understand It To Be An Event Handler for Form_Resize.
<color=blue> private sub Form_Resize()
</color>
<color=green>'Process</color>
</color>
-
Feb 11th, 2001, 10:58 AM
#8
Matthew Gates: LockWindowupdate will not work, because that will prevent the window from being updated. To accomplish what VBmichael wants, I'm pretty sure you'd have to subclass.
I'll post the code up as soon as I make it.
-
Feb 11th, 2001, 11:04 AM
#9
Add to a Module
Code:
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Declare Function SetWindowLong& Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long)
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const GWL_WNDPROC = (-4)
Const WM_EXITSIZEMOVE = &H232
Global WndProcOld As Long
Public Function WindProc(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If wMsg = WM_EXITSIZEMOVE Then
'<-- your code here -->
MsgBox "You have finished resizing."
End If
WindProc = CallWindowProc(WndProcOld&, hwnd&, wMsg&, wParam&, lParam&)
End Function
Sub SubClassWnd(hwnd As Long)
WndProcOld& = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindProc)
End Sub
Sub UnSubclassWnd(hwnd As Long)
SetWindowLong hwnd, GWL_WNDPROC, WndProcOld&
WndProcOld& = 0
End Sub
Add to a Form
Code:
Private Sub Form_Load()
SubClassWnd hwnd
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnSubclassWnd hwnd
End Sub
-
Feb 11th, 2001, 03:16 PM
#10
Member
If you don't want the content of the window to change while you are dragging or resizing you window you have to change your settings:
Control panel > Display > Visual effects: turn off Show windows contents while dragging
With this flag turned off you will only see the broder of the form resizing, not the contents.
(Win 98, Win95 ?)
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
|