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. Tomcat 部署项目的三种方法

    1.下载 Tomcat 服务器 ①.官网下载地址:http://tomcat.apache.org/ ②.tomcat 8.0 64位百度云下载地址:http://pan.baidu.com/s/1s ...

  2. bootstrap4中文版(纯手工翻译)

    1初步开始 1.1依赖 这个仓储包含一系列基于bootstrap标识和css样式的原生angular2指令.所以是不需要依赖jq和bootstrap.js的.只需要以下依赖即可: Angular(需要 ...

  3. iOS简单快速集成Cordova

    如果你对于什么是Cordova还不了解,可以先移步到我另一个文章:Cordoval在iOS中的运用整理 里面有详细的介绍跟如何搭建Cordova:而本文则是要介绍JiaCordova插件,如果你有一点 ...

  4. css实现梯形(各种形状)的网页布局——transform的妙用

    在各式各样的网页中,经常会看到形状特别的布局,比如说下面的这种排版方式: 这种视觉上的效果,体验十分好.那么他是如何来实现的呢,博主在这里整理了如下2种实现的方式. 1.通过给 div 加border ...

  5. ImageView最大高度和宽度失效解决方案

    解决方案 做RecyclerView的 item 布局时,用到imageview ,可是图片按原始尺寸显示,不规范. 所以去google了一下imageview的宽高限制,就试了下maxheight/ ...

  6. JavaScript实现上传图片预览[js前端实现]

    <body> <input type="file" id="file_input" onchange="show_image()&q ...

  7. cpp(第九章)

    1.静态外部,不在任何函数内定义.静态内部,不在任何函数内,使用关键字static.静态无连接性,在代码块中,使用关键字static. 2.静态变量会自动零初始化. 3.单定义规则,在每个使用外部变量 ...

  8. 【基础】C#异常处理的总结

    一.异常处理的理解? 异常处理是指程序在运行过程中,发生错误会导致程序退出,这种错误,就叫做异常. 因此处理这种错误,就称为异常处理. 二.异常处理如何操作? C# 异常处理时建立在四个关键词之上的: ...

  9. PHP的SQL注入技术实现以及预防措施

    SQL 攻击(SQL injection,台湾称作SQL资料隐码攻击),简称注入攻击,是发生于应用程序之数据库层的安全漏洞.简而言之,是在输入的字符串之中注入SQL指 令,在设计不良的程序当中忽略了检 ...

  10. discuz用户登录不响应,提示nginx gateway timeout解决方法

    在使用nginx+php-cgi搭建discuz论坛过程中,出现论坛登录不响应,一直提示nginx gateway timeout504网关超时,单单采用php方式登录无问题.但因需要使用nginx把 ...