利用VB怎么实现在第一个窗口里点开网页的GG广告才能显示第二个窗口?

在第一个FORM里用WebBrowser1显示一个网页广告,用户点击后才能显示另一个窗口。并且显示的广告页不是用IE打开的最好是用户暂时无法关闭的。... 在第一个FORM里用WebBrowser1显示一个网页广告,用户点击后才能显示另一个窗口。并且显示的广告页不是用IE打开的最好是用户暂时无法关闭的。 展开
 我来答
52xenos
2010-02-08 · TA获得超过3032个赞
知道小有建树答主
回答量:1154
采纳率:0%
帮助的人:0
展开全部
将WebBrowser1放在form2,form2没有边框,位置遮挡住form1
这样就先显示广告,且无法关闭(因为没有边框)
WebBrowser1检测到鼠标点击后form2.hide,显示form1内容即可
积分国Live事务部
2010-02-08 · TA获得超过214个赞
知道小有建树答主
回答量:212
采纳率:0%
帮助的人:153万
展开全部
将WebBrowser1放在form2,form2没有边框,位置遮挡住form1
这样就先显示广告,且无法关闭(因为没有边框)
WebBrowser1检测到鼠标点击后form2.hide,显示form1内容即可
webbrowser:
WebBrowser
[编辑本段]WebBrowser 类

[1]WebBrowser 是一个 .NET 控件类,在 .NET Framework 2.0 版中新增。WebBrowser 类使用户可以在窗体中导航网页。
命名空间:System.Windows.Forms
程序集:System.Windows.Forms(在 system.windows.forms.dll 中)
语法
Visual Basic(声明)
<ComVisibleAttribute(True)> _<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _Public Class WebBrowser Inherits WebBrowserBase
Visual Basic(用法)
Dim instance As WebBrowser
C#
[ComVisibleAttribute(true)] [ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] public class WebBrowser : WebBrowserBase
C++
[ComVisibleAttribute(true)] [ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] public ref class WebBrowser : public WebBrowserBase
J#
/** @attribute ComVisibleAttribute(true) */ /** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ public class WebBrowser extends WebBrowserBase
JScript
ComVisibleAttribute(true) ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) public class WebBrowser extends WebBrowserBase
备注
使用 WebBrowser 控件可以在 Windows 窗体应用程序中承载网页以及支持浏览器的其他文档。例如,可以使用 WebBrowser 控件在应用程序中提供基于 HTML 的集成用户帮助或 Web 浏览功能。此外,还可以使用 WebBrowser 控件向 Windows 窗体客户端应用程序添加基于 Web 的现有控件。
重要事项:
WebBrowser 控件会占用大量资源。使用完该控件后一定要调用 Dispose 方法,以便确保及时释放所有资源。必须在附加事件的同一线程上调用 Dispose 方法,该线程应始终是消息或用户界面 (UI) 线程。
WebBrowser 控件不能由部分受信任的代码使用。
WebBrowser 控件具有多个与导航相关的属性、方法和事件。使用下面的成员可以将控件导航到特定 URL、在导航历史记录列表中向后和向前移动,还可以加载当前用户的主页和搜索页:
Url
Navigate
GoBack
GoForward
GoHome
GoSearch
如果导航不成功,则显示一页指示出现的问题。使用这些成员中的任何一个进行导航都会导致在导航的不同阶段发生 Navigating、Navigated 和 DocumentCompleted 事件。
使用这些成员和其他成员(如 Stop 和 Refresh 方法)可以在应用程序中实现与 Internet Explorer 中的用户界面控件类似的用户界面控件。即使不希望在窗体上显示 WebBrowser 控件,某些成员也十分有用。例如,可以使用 Print 方法打印网页的最新版本,而不向用户显示该页。
使用 WebBrowser 控件还可以显示在应用程序中创建的内容或从数据库或资源文件检索的内容。使用 DocumentText 或 DocumentStream 属性,以字符串或数据流的形式获取或设置当前文档的内容。
还可以通过 Document 属性操作网页的内容,该属性包含一个 HtmlDocument 对象,向当前页提供对 HTML 文档对象模型 (DOM) 的托管访问。该属性与 ObjectForScripting 属性组合使用时,对在应用程序代码与网页中的动态 HTML (DHTML) 代码之间实现双向通信十分有用,使用它可以在单个用户界面中组合基于 Web 的控件和 Windows 窗体控件。在应用程序中可以使用 Document 属性调用脚本代码方法。脚本代码可以通过 window.external 对象访问应用程序,该对象是用于主机访问的内置 DOM 对象,它映射到为 ObjectForScripting 属性指定的对象。
注意
该类要求类级别上的安全性。如果派生类或调用堆栈中的任何调用方不具有完全信任权限,则会引发 SecurityException。有关安全要求的详细信息,请参见 链接要求 和 继承要求。
注意
WebBrowser 类仅能用于设置为单线程单元 (STA) 模式的线程。若要使用此类,请确保使用 STAThreadAttribute 属性标记 Main 方法。
Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows CE 平台说明: 要实现 .NET Compact Framework 应用程序中的 WebBrowser 的完整功能,需要用于 Pocket PC 和 Smartphone 的 Windows Mobile 5.0 版软件。有关更多信息,请参见 如何:在 .NET Compact Framework 中使用 WebBrowser 控件。
示例
下面的代码示例演示如何使用 WebBrowser 控件实现地址栏。此示例要求窗体包含一个名为 webBrowser1 的 WebBrowser 控件、一个名为 TextBoxAddress 的 TextBox 控件和一个名为 ButtonGo 的 Button 控件。在文本框中键入 URL 并按 Enter 或单击“转到”按钮时,WebBrowser 控件会定位至指定的 URL。通过单击超链接进行定位时,文本框会自动更新以显示当前 URL。
Visual Basic
' Navigates to the URL in the address box when
' the ENTER key is pressed while the ToolStripTextBox has focus.
Private Sub toolStripTextBox1_KeyDown( _
ByVal sender As Object, ByVal e As KeyEventArgs) _
Handles toolStripTextBox1.KeyDown
If (e.KeyCode = Keys.Enter) Then
Navigate(toolStripTextBox1.Text)
End If
End Sub
' Navigates to the URL in the address box when
' the Go button is clicked.
Private Sub goButton_Click( _
ByVal sender As Object, ByVal e As EventArgs) _
Handles goButton.Click
Navigate(toolStripTextBox1.Text)
End Sub
' Navigates to the given URL if it is valid.
Private Sub Navigate(ByVal address As String)
If String.IsNullOrEmpty(address) Then Return
If address.Equals("about:blank") Then Return
If Not address.StartsWith("http://") And _
Not address.StartsWith("https://") Then
address = "http://" & address
End If
Try
webBrowser1.Navigate(New Uri(address))
Catch ex As System.UriFormatException
Return
End Try
End Sub
' Updates the URL in TextBoxAddress upon navigation.
Private Sub webBrowser1_Navigated(ByVal sender As Object, _
ByVal e As WebBrowserNavigatedEventArgs) _
Handles webBrowser1.Navigated
toolStripTextBox1.Text = webBrowser1.Url.ToString()
End Sub
C#
// Navigates to the URL in the address box when
// the ENTER key is pressed while the ToolStripTextBox has focus.
private void toolStripTextBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
Navigate(toolStripTextBox1.Text);
}
}
// Navigates to the URL in the address box when
// the Go button is clicked.
private void goButton_Click(object sender, EventArgs e)
{
Navigate(toolStripTextBox1.Text);
}
// Navigates to the given URL if it is valid.
private void Navigate(String address)
{
if (String.IsNullOrEmpty(address)) return;
if (address.Equals("about:blank")) return;
if (!address.StartsWith("http://") &&
!address.StartsWith("https://"))
{
address = "http://" + address;
}
try
{
webBrowser1.Navigate(new Uri(address));
}
catch (System.UriFormatException)
{
return;
}
}
// Updates the URL in TextBoxAddress upon navigation.
private void webBrowser1_Navigated(object sender,
WebBrowserNavigatedEventArgs e)
{
toolStripTextBox1.Text = webBrowser1.Url.ToString();
}
C++
// Navigates to the URL in the address text box when
// the ENTER key is pressed while the text box has focus.
void TextBoxAddress_KeyDown( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e )
{
if ( e->KeyCode == System::Windows::Forms::Keys::Enter && !this->TextBoxAddress->Text->Equals( "" ) )
{
this->WebBrowser1->Navigate( this->TextBoxAddress->Text );
}
}
// Navigates to the URL in the address text box when
// the Go button is clicked.
void ButtonGo_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
if ( !this->TextBoxAddress->Text->Equals( "" ) )
{
this->WebBrowser1->Navigate( this->TextBoxAddress->Text );
}
}
// Updates the URL in TextBoxAddress upon navigation.
void WebBrowser1_Navigated( Object^ /*sender*/, System::Windows::Forms::WebBrowserNavigatedEventArgs^ /*e*/ )
{
this->TextBoxAddress->Text = this->WebBrowser1->Url->ToString();
}
继承层次结构
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.WebBrowserBase
System.Windows.Forms.WebBrowser
线程安全
此类型的任何公共静态(Visual Basic 中的 Shared)成员都是线程安全的,但不保证所有实例成员都是线程安全的。
平台
Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0
.NET Compact Framework
受以下版本支持:2.0
请参见
参考
WebBrowser 成员
System.Windows.Forms 命名空间
其他资源
WebBrowser 控件(Windows 窗体)
通过部分受信任的代码使用库
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
掉下来的梨子
2010-02-11
知道答主
回答量:19
采纳率:0%
帮助的人:0
展开全部
这样就先显示广告,且无法关闭(因为没有边框)
WebBrowser1检测到鼠标点击后form2.hide,显示form1
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式