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. JAVA – 虚函数、抽象函数、抽象类、接口

     本文转载地址:http://blog.csdn.net/trojanpizza/article/details/6556604 1. Java虚函数 虚函数的存在是为了多态. C++中普通成员函数加 ...

  2. DES加密例子

    Java密码学结构设计遵循两个原则: 1) 算法的独立性和可靠性. 2) 实现的独立性和相互作用性. 算法的独立性是通过定义密码服务类来获得.用户只需了解密码算法的概念,而不用去关心如何实现这些概念. ...

  3. OpenStack命令 创建网络和路由管理

    1.登陆用户 :tdy(前提条件创建了tdy用户) 编写登陆用户tdy用户 脚本文件  user-operc.sh user-operc.sh : 登陆用户tdy: $ source user-ope ...

  4. DATA VISUALIZATION – PART 2

    A Quick Overview of the ggplot2 Package in R While it will be important to focus on theory, I want t ...

  5. TensorFlow for R

    TensorFlow™ is an open source software library for numerical computation using data flow graphs. Nod ...

  6. Include promo/activity effect into the prediction (extended ARIMA model with R)

    I want to consider an approach of forecasting I really like and frequently use. It allows to include ...

  7. 第40篇 使用Sublime+MarkDown快速写博客

    原文地址:http://blog.laofu.online/2017/06/03/how-use-sublime/ 前端的开发人员应该都知道sublime的神器,今天就说说如何使用sublime结合m ...

  8. LCA——求解最近公共祖先

    LCA 在有根树中,两个节点 u 和 v 的公共祖先中距离最近的那个被称为最近公共祖先(LCA,Lowest Common Ancestor). 有多种算法解决 LCA 或相关的问题. 基于二分搜索的 ...

  9. cpp(第三章)

    1.使用{}初始化时,{}若为空则默认初始化为0,至于防范类型转化错误 2.int对计算机而言最为自然的长度,处理起来效率最高的长度.int可能是short(16位)也可能是long(32位),在知道 ...

  10. 干货 | 云智慧透视宝Java代码性能监控实现原理

    这篇图文并茂,高端大气上档次,思维缜密的文章,一看就和我平时的风格不同.对了.这不是我写的,是我家高大英俊,写一手好代码,做一手好菜的男神老公的大作,曾发表于技术公号,经本人授权转载~~ 一.Java ...