Overrides for WndProc... using the overriden component class on a form...

  • Thread starter Matt Brown - identify
  • Start date
M

Matt Brown - identify

Hello,


I'm very new to this level of programming and .net in general. My
background is VB.


I am attempting to use the WebBrowser control to load a flash movie,
and it is a known issue that the WebBrowser control doesn't natively
support mouse clicks (unless the form loses and regains focus).


A workaround has been presented over at CodeProject and it is as
follows:


Imports System
Imports System.Collections.Generic
Imports System.Text

Public Class myWebBrowser
Inherits System.Windows.Forms.WebBrowser

Protected Overrides Sub WndProc(ByRef m As
System.Windows.Forms.Message)
Select Case m.Msg
Case &H201, &H204, &H207, &H21 ' WM_LMOUSEBUTTON
MyBase.DefWndProc(m)
Return
End Select
MyBase.WndProc(m)
End Sub 'WndProc
End Class 'myWebBrowse



My question is, how and where do I implement this? Do I make a new
class and put this there? How do I use the "myWebBrowser" class to
create the component that appears on the form?


If you can point me in the right direction, it'd be appreciated. I've
found plenty of documentation on overriding, and controls, but none on
creating and using a component control.


Thanks very much,

Matt
 
R

rowe_newsgroups

I would add a new class file to your project and add it there. Then,
do a Project => Rebuild and open up the form you wish to use the
control on. At the top of the toolbox there is a group (the name
escapes me) that contains all of your project's custom controls.
Alternatively, you can drag the class's name from the solution
explorer onto the form to add the control that way. A third option is
to add the control dynamically (usually for parameterized
constructors) but you probably don't need to do that here.

If I can help out more let me know!

Thanks,

Seth Rowe
 
M

Matt Brown - identify

I would add a newclassfile to your project and add it there. Then,
do a Project => Rebuild and open up theformyou wish to use the
control on. At the top of the toolbox there is a group (the name
escapes me) that contains all of your project's custom controls.
Alternatively, you can drag theclass'sname from the solution
explorer onto theformto add the control that way. A third option is
to add the control dynamically (usually for parameterized
constructors) but you probably don't need to do that here.

If I can help out more let me know!

Thanks,

Seth Rowe


Exactly what I was looking for! Thanks very much!


-Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top