UI短手或者GDI+用烦的童鞋可以借用WebBrowser打造漂亮的程序界面,只需要下载一个好看点的html代码就够了。

引用:

  Microsoft Html Object Library

部件:

  Microsoft Internet Controls

这里以一个简单的登陆界面作为示例,实现代码:

Private WithEvents HtmlDocument As MSHTML.HtmlDocument
Private WithEvents HtmlElement As MSHTML.HTMLButtonElement 'code by lichmama from cnblogs.com
Private Sub Form_Load()
With WebBrowser1
.Left =
.Top =
.Navigate "file://C:\Users\Administrator\Desktop\test.html"
End With
End Sub Private Sub Form_Resize()
With WebBrowser1
.Width = Me.Width
.Height = Me.Height
End With
End Sub Private Sub Form_Unload(Cancel As Integer)
Set HtmlElement = Nothing
Set HtmlDocument = Nothing
End Sub Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
With WebBrowser1
'get the HtmlDocument from webbrowser,
' and bind the control of button to [HtmlElement],
' and setup the event handler of [mybutton]'s onclick.
Set HtmlDocument = .Document
Set HtmlElement = HtmlDocument.getElementById("submit")
End With
End Sub Private Function HtmlDocument_oncontextmenu() As Boolean
'屏蔽右键菜单
HtmlDocument_oncontextmenu = False
End Function Private Function HtmlElement_OnClick() As Boolean
'in this section, we can do any operations to current page.
' think about it, if this is a submit button, we could verify the password, whatever.
username = HtmlDocument.getElementById("login_username").Value
password = HtmlDocument.getElementById("login_password").Value
Debug.Print "your username:", username
Debug.Print "your password:", password
HtmlElement_OnClick = False
End Function

test.html(@http://www.jb51.net/css/97304.html):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>纯CSS3制作的 登录模板 简洁蓝白(非IE效果更好)</title>
<meta content="text/html; charset=unicode" http-equiv="Content-Type" />
<style>
h1, h2, h3, h4, h5, h6{
font-weight:normal;
margin:;
line-height:.1em;
color:#;
}
h1{font-size:2em;margin-bottom:.5em;}
h2{font-size:.75em;margin-bottom:.5142em;padding-top:.2em;}
h3{font-size:.5em;margin-bottom:.7em;padding-top:.3em;}
h4{font-size:.25em;margin-bottom:.6em;}
h5,h6{font-size:1em;margin-bottom:.5em;font-weight:bold;}
p, blockquote, ul, ol, dl, form, table, pre{line-height:inherit;margin: .5em ;}
ul, ol, dl{padding:;}
ul ul, ul ol, ol ol, ol ul, dd{margin:;}
li{margin: 2em;padding:;display:list-item;list-style-position:outside;}
blockquote, dd{padding: 2em;}
pre, code, samp, kbd, var{font:% mono-space,monospace;}
pre{overflow:auto;}
abbr, acronym{
text-transform:uppercase;
border-bottom:1px dotted #;
letter-spacing:1px;
}
abbr[title], acronym[title]{cursor:help;}
small{font-size:.9em;}
sup, sub{font-size:.8em;}
em, cite, q{font-style:italic;}
img{border:none;}
hr{display:none;}
table{width:%;border-collapse:collapse;}
th,caption{text-align:left;}
form div{margin:.5em ;clear:both;}
label{display:block;}
fieldset{margin:;padding:;border:none;}
legend{font-weight:bold;}
input[type="radio"],input[type="checkbox"], .radio, .checkbox{margin: .25em ;}
/* base */
body, table, input, textarea, select, li, button{
font:1em "Lucida Sans Unicode", "Lucida Grande", sans-serif;
line-height:.5em;
color:#;
}
body{
font-size:12px;
background:#c4f0f1;
text-align:center;
}
/* login form */
#login{
margin:5em auto;
background:#fff;
border:8px solid #eee;
width:500px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
-moz-box-shadow: 10px #4e707c;
-webkit-box-shadow: 10px #4e707c;
box-shadow: 10px #4e707c;
text-align:left;
position:relative;
}
#login a, #login a:visited{color:#0283b2;}
#login a:hover{color:#;}
#login h1{
background:#0092c8;
color:#fff;
text-shadow:#007dab 1px ;
font-size:14px;
padding:18px 23px;
margin: .5em ;
border-bottom:1px solid #007dab;
}
#login .register{
position:absolute;
float:left;
margin:;
line-height:30px;
top:-40px;
right:;
font-size:11px;
}
#login p{margin:.5em 25px;}
#login div{
margin:.5em 25px;
background:#eee;
padding:4px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
text-align:right;
position:relative;
}
#login label{
float:left;
line-height:30px;
padding-left:10px;
}
#login .field{
border:1px solid #ccc;
width:280px;
font-size:12px;
line-height:1em;
padding:4px;
-moz-box-shadow:inset 5px #ccc;
-webkit-box-shadow:inset 5px #ccc;
box-shadow:inset 5px #ccc;
}
#login div.submit{background:none;margin:1em 25px;text-align:left;}
#login div.submit label{float:none;display:inline;font-size:11px;}
#login button{
border:;
padding: 30px;
height:30px;
line-height:30px;
text-align:center;
font-size:14px;
Font-Weight:bold;
color:#fff;
text-shadow:#007dab 1px ;
background:#0092c8;
-moz-border-radius:50px;
-webkit-border-radius:50px;
border-radius:50px;
cursor:pointer;
}
#login .forgot{text-align:right;font-size:11px;}
#login .back{padding:1em ;border-top:1px solid #eee;text-align:right;font-size:20px;}
#login .error{
float:left;
position:absolute;
left:%;
top:-5px;
background:#;
padding:5px 10px;
font-size:11px;
color:#fff;
text-shadow:# 1px ;
text-align:left;
white-space:nowrap;
border:1px solid #;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
-moz-box-shadow: 5px #;
-webkit-box-shadow: 5px #;
box-shadow: 5px #;
}
</style>
<style id="wiz_custom_css" type="text/css">
body
{
font-family: 微软雅黑,Georgia,Helvetica,Arial,sans-serif,宋体,serif;
font-size: .5pt;
line-height: 1.5;
border:0px;
overflow:hidden;
}
html, body, div, span, applet, object, iframe, p, blockquote, pre,
abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td
{
color: inherit;
background-color: inherit;
}
h1 {
font-size:.5em;
font-weight:bold;
}
h2 {
font-size:.4em;
font-weight:bold;
}
h3 {
font-size:.3em;
font-weight:bold;
}
h4 {
font-size:.2em;
font-weight:bold;
}
h5 {
font-size:.1em;
font-weight:bold;
}
h6 {
font-size:.0em;
font-weight:bold;
}
img {
border:;
}
</style>
<meta name="GENERATOR" content="MSHTML 9.00.8112.16421" />
</head>
<body scroll="no">
<form id="login" method="post" action="">
<h1><strong>用户登录</strong></h1>
<div>
<label for="login_username"><strong>账户:</strong></label>
<input id="login_username" class="field required" title="请输入您的账户" name="username" />
</div>
<div>
<label for="login_password"><strong>密码:</strong></label>
<input id="login_password" class="field required" title="密码不能为空" name="password" type="password" />
</div>
<div class="submit">
<button type="submit" id="submit">登录</button>
</div>
</form>
</body>
</html>

然后,让我们来看看效果:

貌似还不错的样子

VB6之WebBrowser控件的更多相关文章

  1. vb6中webbrowser控件树转换备忘

    Dim doc As HTMLDocument Set doc = WebBrowser1.Document Dim inputs As IHTMLElementCollection Set inpu ...

  2. C#中的WebBrowser控件的使用

    0.常用方法   Navigate(string urlString):浏览urlString表示的网址 Navigate(System.Uri url):浏览url表示的网址 Navigate(st ...

  3. delphi WebBrowser控件上网页验证码图片识别教程(一)

    步骤一:获取网页中验证码图片的url地址 在delphi中加入一个BitBtn和一个memo以及WebBrowser控件实现网页中验证码图片的url地址的获取 程序如下:procedure TForm ...

  4. <总结>delphi WebBrowser控件的使用中出现的bug

    Delphi WebBrowser控件的使用中出现的bug:  1.WebBrowser.Visible=false:Visible属性不能使WebBrowser控件不可见,暂时用 WebBrowse ...

  5. C# WebBrowser控件使用教程与技巧收集

    常用的方法 Navigate(string urlString):浏览urlString表示的网址 Navigate(System.Uri url):浏览url表示的网址 Navigate(strin ...

  6. C# 指定Webbrowser控件所用IE内核版本

    如果电脑上安装了IE8或者之后版本的IE浏览器,Webbrowser控件会使用IE7兼容模式来显示网页内容.解决方法是在注册表中为你的进程指定引用IE的版本号. 比如我的程序叫做a.exe,以64位机 ...

  7. 在WPF的WebBrowser控件中屏蔽脚本错误的提示

    在WPF中使用WebBrowser控件显示网页时,经常会报脚本错误的提示,如何屏蔽掉这些错误提示呢.方法是定义如下方法: public void SuppressScriptErrors(WebBro ...

  8. 修改WebBrowser控件的内核解决方案

    方法一 加入你想让WebBrowser控件的渲染模式编程IE8的标准模式, 你可以通过设置注册表FEATURE_BROWSER_EMULATION 来实现. 示例: 注册表中注明当前本机装的IE版本H ...

  9. C# webBrowser控件使用

    C# webBrowser控件使用心得 最近用到WebBrowser控件,遇到很多问题,也学习了不少新的东西.下面是我在C#下写的关于WebBrowser控件使用的代码. 1.WebBrowser常用 ...

随机推荐

  1. 关于微信分享JSSDK使用需注意的几点问题

    微信公众平台技术文档中有微信JS-SDK说明文档,详情见地址https://mp.weixin.qq.com/wiki 官方给出了使用步骤和DEMO,下面说一下几点需要注意的问题. 1.登录微信公众平 ...

  2. (中级篇 NettyNIO编解码开发)第八章-Google Protobuf 编解码-2

    8.1.2    Protobuf编解码开发 Protobuf的类库使用比较简单,下面我们就通过对SubscrjbeReqProto进行编解码来介绍Protobuf的使用. 8-1    Protob ...

  3. Java反射机制剖析(三)-简单谈谈动态代理

    通过Java反射机制剖析(一)和Java反射机制剖析(二)的学习,已经对反射有了一定的了解,这一篇通过动态代理的例子来进一步学习反射机制. 1.     代理模式 代理模式就是为其他对象提供一种代理来 ...

  4. java中String是对象还是类?详解java中的String

    有很多人搞不懂对象和类的定义.比如说java中String到底是对象还是类呢? 有人说String 既可以说是类,也可以说是对象. 其实他这么说也没问题, 类和对象其实都是一个抽象的概念. 我们可以把 ...

  5. ASP.NET Core:使用EntityFrameworkCore操作MySql来丰富仓储模块

    概述 上一篇简单介绍了Dapper的基本用法,数据的存储为SqlServer.那么这一篇就记录一下使用EFCore来操作MySql的一些方式,这种模式比较适合那种一个项目中需要操作多种数据库的模式.不 ...

  6. docker安装与学习

    docker学习 以ubuntu为实例 第一步检查系统内核>3.80 第二步 安装Docker 之前先更新apt-get update 在执行安装命令 apt-get install -y do ...

  7. JavaWeb系列:Servlet

    个人整理,欢迎转载与批评建议,转载请添加索引,谢谢. ---------------------------------------------------------------2017.06.10 ...

  8. NodeMCU入门(2):在线构建、刷入固件,上传代码

    准备工作 1.NodeMCU模块 2.ESP8266Flasher.exe 3.ESPlorer v0.2.0-rc6 构建固件 Building the firmware提供了三种构建你自己固件的方 ...

  9. python之路第一篇

    一.python环境的搭建 1.window下环境的搭建 (1).在 https://www.python.org/downloads/ 下载自己系统所需要的python版本 (2).安装python ...

  10. zookeeper-开始

    ZooKeeper:为分布式应用提供的分布式协调服务 ZooKeeper提供一系列原语用于分布式应用构建更高层次的服务,如同步.配置维护.分组以及命名空间. 设计目标: ZooKeeper足够简单且可 ...