![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
#4
| |||
| |||
|
|
This is a known issue of the .NET 2.0 WebBrowser control code. We're sorry for the inconvenience caused. Here's the workaround for the WebBrowser code: we need to inherit from the WebBrowser control and override its WndProc to handle the mouse releated messages: Public Class MyWebBrowser Inherits System.Windows.Forms.WebBrowser Const WM_LBUTTONDOWN As Integer = &H201 Const WM_RBUTTONDOWN As Integer = &H204 Const WM_MBUTTONDOWN As Integer = &H207 Const WM_MOUSEACTIVATE As Integer = &H21 Private Function FindContainerControl() As ContainerControl Dim cc As ContainerControl = Nothing Dim ctl As Control = Me Do While Not ctl Is Nothing Dim tempCC As ContainerControl = TryCast(ctl, ContainerControl) If Not tempCC Is Nothing Then cc = tempCC Exit Do End If ctl = ctl.Parent Loop Return cc End Function Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Select Case m.Msg Case WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_MBUTTONDOWN, WM_MOUSEACTIVATE If Not DesignMode Then Dim cc As ContainerControl = FindContainerControl() If Not cc Is Nothing AndAlso Not cc.ActiveControl Is Me Then cc.Focus() End If End If DefWndProc(m) Case Else MyBase.WndProc(m) End Select End Sub End Class |
#5
| |||
| |||
|
|
Hi Lance, This is a known issue of the .NET 2.0 WebBrowser control code. We're sorry for the inconvenience caused. Here's the workaround for the WebBrowser code: we need to inherit from the WebBrowser control and override its WndProc to handle the mouse releated messages: Public Class MyWebBrowser Inherits System.Windows.Forms.WebBrowser Const WM_LBUTTONDOWN As Integer = &H201 Const WM_RBUTTONDOWN As Integer = &H204 Const WM_MBUTTONDOWN As Integer = &H207 Const WM_MOUSEACTIVATE As Integer = &H21 Private Function FindContainerControl() As ContainerControl Dim cc As ContainerControl = Nothing Dim ctl As Control = Me Do While Not ctl Is Nothing Dim tempCC As ContainerControl = TryCast(ctl, ContainerControl) If Not tempCC Is Nothing Then cc = tempCC Exit Do End If ctl = ctl.Parent Loop Return cc End Function Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Select Case m.Msg Case WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_MBUTTONDOWN, WM_MOUSEACTIVATE If Not DesignMode Then Dim cc As ContainerControl = FindContainerControl() If Not cc Is Nothing AndAlso Not cc.ActiveControl Is Me Then cc.Focus() End If End If DefWndProc(m) Case Else MyBase.WndProc(m) End Select End Sub End Class I've tested it on my side using this customized WebBrowser control with the URL you provided, it's working correctly. Please test it on your side and let me know the result. Thanks. Sincerely, Walter Wang (wawang (AT) online (DOT) microsoft.com, remove 'online.') Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscripti...ult.aspx#notif ications. If you are using Outlook Express, please make sure you clear the check box "Tools/Options/Read: Get 300 headers at a time" to see your reply promptly. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscripti...t/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |