A
a
I'm trying to stop a from from redrawing to prevent a textbox scroll
bug. Whenever I try to use Textbox.ScrollToCaret, the textbox scrolls
to the top line, then to the proper location. It's really distracting.
I'm trying to stop the form from redrawing, but it's not working.
Here's what I've tried so far, taken from a blog I ran across.
Dim Ret As IntPtr
Dim eventMask As IntPtr = IntPtr.Zero
Try
Ret = Win32Window.SendMessage( _
HWND,WM_SETREDRAW,-1,IntPtr.Zero)
Debug.WriteLine("SetRedraw ME - Ret = " & Ret.ToString)
eventMask = Win32Window.SendMessage( _
txtDataHWND,EM_GETEVENTMASK,0,IntPtr.Zero)
Ret = Win32Window.SendMessage(txtDataHWND, EM_SCROLLCARET, 0, 0)
Debug.WriteLine("ScrollToCaret - Ret = " & Ret.ToString)
Catch ex As Exception
Debug.WriteLine("Exception Trying to Scroll: " & ex.Message)
Finally
Win32Window.SendMessage( _
txtDataHWND, EM_SETEVENTMASK, 0, eventMask)
Ret = Win32Window.SendMessage( _
HWND, WM_SETREDRAW, 0, IntPtr.Zero)
Debug.WriteLine("SetRedraw ME - Ret = " & Ret.ToString)
End Try
I've also tried modifying it to send the WM_SETREDRAW message to the
Textbox directly, but neither of these functions worked.
bug. Whenever I try to use Textbox.ScrollToCaret, the textbox scrolls
to the top line, then to the proper location. It's really distracting.
I'm trying to stop the form from redrawing, but it's not working.
Here's what I've tried so far, taken from a blog I ran across.
Dim Ret As IntPtr
Dim eventMask As IntPtr = IntPtr.Zero
Try
Ret = Win32Window.SendMessage( _
HWND,WM_SETREDRAW,-1,IntPtr.Zero)
Debug.WriteLine("SetRedraw ME - Ret = " & Ret.ToString)
eventMask = Win32Window.SendMessage( _
txtDataHWND,EM_GETEVENTMASK,0,IntPtr.Zero)
Ret = Win32Window.SendMessage(txtDataHWND, EM_SCROLLCARET, 0, 0)
Debug.WriteLine("ScrollToCaret - Ret = " & Ret.ToString)
Catch ex As Exception
Debug.WriteLine("Exception Trying to Scroll: " & ex.Message)
Finally
Win32Window.SendMessage( _
txtDataHWND, EM_SETEVENTMASK, 0, eventMask)
Ret = Win32Window.SendMessage( _
HWND, WM_SETREDRAW, 0, IntPtr.Zero)
Debug.WriteLine("SetRedraw ME - Ret = " & Ret.ToString)
End Try
I've also tried modifying it to send the WM_SETREDRAW message to the
Textbox directly, but neither of these functions worked.