can not active Contacts.PreviewContactDownEvent

Aug 3, 2009 at 3:11 AM

Code:

WebBrowser web = new WebBrowser();
web.AddHandler(Contacts.PreviewContactDownEvent, new ContactEventHandler(WebBrowser_PreviewContactDown));
web.Navigate(new Uri("http://ditu.google.com/"));
m_Canvas.Children.Add(web);

when i touch the browser, can not active the WebBrowser_PreviewContactDown.  why?

Coordinator
Aug 3, 2009 at 3:45 AM

This forum isn't for general Surface help, but I can answer your question anyway.

The WebBrowser control is a wrapper for a Win32 control, and Win32 does not respond to or interact with Surface contacts.  This is also why the WebBrowser control cannot be rotated or transformed.  There are some ways to get around this but in general browsing the web on the Surface is not an ideal experience or recommended task. 

If you have access to http://community.surface.com you can search for WebBrowser to see some options.

Aug 3, 2009 at 3:59 AM

can not sign into http://community.surface.com

error: Sorry! It appears you either don’t have an invitation or your invitation has already been used. If you feel this is an error, please contact us or your company sponsor.

Coordinator
Aug 3, 2009 at 4:01 AM

You'll have to talk to your company or organization that you're developing Surface for to see if they can get you an invite.

Aug 3, 2009 at 4:08 AM

Thanks joshb!

can i do that like the SurfaceVEMap control

Coordinator
Aug 3, 2009 at 4:11 AM

The core Virtual Earth control is also Win32 based, but I made it work fully with WPF and Surface by doing some tricks and interacting with the control in some specific ways.  That won't apply to the WebBrowser control.

Aug 3, 2009 at 4:16 AM

i just for active Contacts.PreviewContactDownEvent when touch the webbrowser control range

Coordinator
Aug 3, 2009 at 4:24 AM

I don't have any code samples or further information on the WebBrowser, but the basic idea is you have to make a transparent window on top that catches the events then manually forward those to the WebBrowser control.  This approach causes a lot of other problems though too that you'll have to work through. 

 

Aug 3, 2009 at 5:09 AM

i had try by the SurfaceVEMap control way , but fail.

the code : http://files.cnblogs.com/zengshmin/SurfaceBrower.rar

could you help me?

 

Coordinator
Aug 3, 2009 at 11:34 AM

I took a quick glance and see you tried to use some code from SurfaceVEMap.  The WebBrowser control will not work the same way because it is not rendered using Direct3D.  The SurfaceVEMap approach won't work for you.  You need to get access to community.surface.com to see other code samples.

Sorry I can't be of more help.

Aug 3, 2009 at 11:53 AM

hi joshb

you are right.

so i try to make a transparent surface control on top the webbrowser,but not any surface control can top the webbrowser.

no way to do that????