Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Resizing help

45 views
Skip to first unread message

Matt Burland

unread,
Jul 19, 2004, 9:30:03 PM7/19/04
to
I need to be able to disable some things from happening while a window is
being resized, i.e. while the window is being dragged with the left mouse
button down, and have these things be re-enabled when the resizing is done.
Does anybody know how to do this properly. I thought I could intercept the
MouseDown and MouseUp events and use that to set a flag that could be read
in the Resize event and used to disable stuff (and re-enable when the mouse
button is released), but it seems the MouseDown and MouseUp events don't get
fired when the pointer is on the border of the a window (where you grab it
to drag it) instead of actually in the window.
Any ideas?


Mick Doherty

unread,
Jul 20, 2004, 4:26:39 AM7/20/04
to
A vb.net solution (easily translated to C#)

Protected Const WM_SIZING As Int32 = &H214
Protected Const WM_ENTERSIZEMOVE As Int32 = &H231
Protected Const WM_EXITSIZEMOVE As Int32 = &H232
Protected Const WM_SYSCOMMAND As Int32 = &H112
Protected Const SC_SIZE As Int32 = &HF000

'If you Inherit from this form then you'll be able to use these events
'without seeing the code, otherwise these events are not necessary.
Public Event BeginResize As EventHandler
Public Event EndResize As EventHandler

Protected Overridable Sub OnBeginResize(ByVal e As EventArgs)
RaiseEvent BeginResize(Me, e)
'Disable stuff here
End Sub

Protected Overridable Sub OnEndResize(ByVal e As EventArgs)
RaiseEvent EndResize(Me, e)
'Re-enable stuff here
End Sub

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Static SizeMode As Boolean = False
Select Case m.Msg
Case WM_SIZING
'Already have a Resize Method
Case WM_SYSCOMMAND
SizeMode = ((m.WParam.ToInt32 And &HFFF0) = SC_SIZE)
Case WM_ENTERSIZEMOVE
If SizeMode Then
OnBeginResize(EventArgs.Empty)
End If
Case WM_EXITSIZEMOVE
If SizeMode Then
OnEndResize(EventArgs.Empty)
End If
Case Else
End Select
MyBase.WndProc(m)
End Sub

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html


"Matt Burland" <wjousts@[nospam]hotmail.com> wrote in message
news:emS5zkfb...@TK2MSFTNGP09.phx.gbl...


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004


0 new messages