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. ArrayList实现分组功能

    这边只用2个属性来进行分组 定义Object有key与value属性 按照key的不同对于arrayList进行分组 List<Object> tempList=new ArrayList ...

  2. 关于python编译的一点小结

    大家都知道python是脚本语言,源码可以直接执行,有时需要提高执行效率或者保密(因为有时候不想让使用人看到源码文件),那就涉及到python编译了,那么该如何做呢? 有两种方法可以做到. 1.一种是 ...

  3. Python中的模块介绍和使用

    在Python中有一个概念叫做模块(module),这个和C语言中的头文件以及Java中的包很类似,比如在Python中要调用sqrt函数,必须用import关键字引入math这个模块,下面就来了解一 ...

  4. [转]tomcat部署(1)

      阅读目录 1 目录结构 2 部署 3 发布 4 测试 本篇参考Tomcat官方文档:<First Webapp>翻译,并结合自己的开发经验介绍关于tomcat部署以及发布的相关内容. ...

  5. java基础(九章)

    一.理解查询的机制 客户端应用程序(c/s.b/s)向后台服务器的DB发送一条select语句进行查询操作,会将结果集(虚拟表)返回到客户端应用程序 二.select语句 1.查询表中的全部列和行 s ...

  6. D语言需要大公司支持

    Facebook开源flint:一个用D语言编写的C++静态代码分析器 http://www.csdn.net/article/2014-02-27/2818565-Building-and-open ...

  7. windows8.1安装之后的感想

    这蛋疼的换了系统之后,发现windows8在界面方面确实花了不少功夫,但是自我感觉,比较适合触屏的平板电脑用.   我笔记本操作体验一般般.windows8不吃内存.这是真的.我机子占了25%左右.刚 ...

  8. windows7 64bit下mvn命令后提示‘cmd’不是内部或外部命令,也不是可执行程序或批处理文件

    首先,开命令提示符,输入如下命令试试echo %M2_HOME% 回车如果显示的路径和安装路径一致说明配置没问题; 那么出现这个问题的原因可能就是路径问题,可能是你安装了某个软件更改了系统映射路径导致 ...

  9. Bash中单引号和双引号的区别

    单引号和双引号的区别 单引号:必须成对使用,它可以保护所有的字符不被翻译.如变量$1,和奇数个单引号的作用相同,偶数个单引号=1个双引号双引号:必须成对出现,它可以保护一些元字符不被翻译,但允许变量和 ...

  10. [POJ 2115} C Looooops 题解(扩展欧几里德)

    题目描述 对于C的for(i=A ; i!=B ;i +=C)循环语句,给出A,B,C和k(k表示变量是在k进制下的无符号整数),判断循环次数,不能终止输出"FOREVER". 输 ...