📄 class_book_begin068.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
.redLink{ color:red;}
.blueLink{color:blue;}
A{font-size:12pt;text-decoration:none;}
P{font:12pt;line-height:22px;}
a:hover{text-decoration:underline}
h2{font-size:30px;text-align:center;color:rgb(0,144,144);letter-spacing:.5em;font-weight:bold}
.whiteB{color:black;background-color:white;}
.blueB{color:yellow;background-color:blue;}
.blackB{color:white;background-color:black;}
</style>
<title>第六章:输入(二)</title>
</head>
<script langue="javascript">
<!--
var source;
var flagDU="Up";
var oldClass="";
function ChangeColor(){
source=window.event.srcElement;
if (source.className=="redLink"){
source.className="blueLink";
}
else{
source.className="redLink";
}
}
function moveChangeBack(){
source=window.event.srcElement;
if (source.className==oldClass){oldClass=source.className;
if (flagDU=="Up"){
if (source.className="whiteB"){
source.className="blueB";
}else{
source.className="whiteB";
}
}else{source.className="blackB";
}
}else{//oldClass=source.className;
if (source.className=="whiteB"){
source.className="blueB";
}else{
source.className="whiteB";
}
}
}
function clickChangeBack(){
index01.className="whiteB"
index02.className="whiteB"
source=window.event.srcElement;
source.className="blackB";
flagDU="Down";
oldClass=source.className;
}
function returnValue(){
index01.className="whiteB";
index02.className="whiteB";
flagDU="Up";
}
function getAppVersion()
{
appname= navigator.appName;
appversion = navigator.appVersion;
majorver = appversion.substring(0, 1);
if ( (appname == "Netscape") && ( majorver >= 3 ) ) return 1;
if ( (appname == "Microsoft Internet Explorer") && (majorver>= 4) ) return 1;
return 0;
}
function switchGraphic(num, imgname) {
if (getAppVersion()) {
document[imgname].src = img[num].src;
}
}//-->
</script>
<body>
<script language="javascript">
<!--
imgsrc = new Array();
imgsrc[0] = "images/dot_blank.gif";
imgsrc[1] = "images/dot_filled.gif";
if (getAppVersion())
{
img = new Array();
for (i = 0; i < imgsrc.length; i++)
{
img[i] = new Image();
img[i].src = imgsrc[i];
}
}
//-->
</script>
<div align="center"><center>
<table border="0" cellpadding="8" cellspacing="0" width="100%">
<tr>
<td width="24%" valign="top"><h2><img src="../images/class_img.gif" WIDTH="160" HEIGHT="51"></h2>
<hr size="4" color="#FF0000" width="75%">
<p align="center"><img src="../images/menu_bar_jc_d.gif" WIDTH="150" HEIGHT="35"><img src="../images/dot_blank.gif" name="b1" WIDTH="10" HEIGHT="35"><br>
<a href="../class_api.htm" onMouseOver="switchGraphic('1','b2')" onMouseOut="switchGraphic('0','b2')"><img src="../images/menu_bar_api.gif" border="0" WIDTH="150" HEIGHT="35"></a><img src="../images/dot_blank.gif" name="b2" WIDTH="10" HEIGHT="35"><br>
<span align="center"><a href="../class_wz.htm" onMouseOver="switchGraphic('1','b5')" onMouseOut="switchGraphic('0','b5')"><img src="../images/menu_bar_wz.gif" border="0" WIDTH="150" HEIGHT="35"></a><img src="../images/dot_blank.gif" name="b5" WIDTH="10" HEIGHT="35"></span><br>
<a href="../class_tip.htm" onMouseOver="switchGraphic('1','b3')" onMouseOut="switchGraphic('0','b3')"><img src="../images/menu_bar_tip.gif" border="0" WIDTH="150" HEIGHT="35"></a><img src="../images/dot_blank.gif" name="b3" WIDTH="10" HEIGHT="35"><br>
<a href="../class_fqa.htm" onMouseOver="switchGraphic('1','b4')" onMouseOut="switchGraphic('0','b4')"><img src="../images/menu_bar_end_fqa.gif" border="0" WIDTH="150" HEIGHT="35"></a><img src="../images/dot_blank.gif" name="b4" WIDTH="10" HEIGHT="35"></p>
<p align="center"><a href="../context.htm"><img src="../images/logo_return.jpg" border="0" WIDTH="70" HEIGHT="260"></a></td>
<td width="76%" valign="top" align="center"><div align="center"><center><table border="0" cellpadding="8" cellspacing="0" width="27%" style="background-color: rgb(0,128,128)">
<tr>
<td width="100%" valign="top" align="center"><a name="top"><font size="5" color="#C0C0C0"><strong>VB入门教程</strong></font></a></td>
</tr>
</table>
</center></div><p><a href="class_book_begin066.htm">第一页</a> <a href="class_book_begin067.htm">第二页</a> 第三页 <a href="../class_book.htm">返回</a></p>
<div align="center"><center><table border="0" cellpadding="8" cellspacing="0" width="100%">
<tr>
<td width="100%"><font size="3" color="#8000FF"><strong><em>第六章:输入(二)</em></strong></font></td>
</tr>
<tr>
<td width="100%" style="background-color: rgb(232,255,254)"><font FACE="宋体" SIZE="3"><p ALIGN="JUSTIFY">与无线钮相对的是检查框,在同一范围内一组无线钮只能有一个被选中,而检查框则可以有多个选择,就象在添表时,性别那项只能有一个选择,而在描述你以前的职业时可以有学生、程序员、家庭教师或者什么,总之有很多选择,下面我们举一个简单的例子加以说明。</p>
<p ALIGN="JUSTIFY">假设编写了一个共享软件,在让用户注册的时候你想知道你的用户使用的计算机情况,你就需要一个调查表,为了使这个调查表不止枯燥,可以在这个程序中加入一些图形。新建一个项目文件,窗体布局如图</font><font SIZE="3">6</font><font FACE="宋体" SIZE="3">-</font><font SIZE="3">10</font><font FACE="宋体" SIZE="3">。</p>
<p ALIGN="JUSTIFY"><img src="06-10.gif" alt="06-10.gif (5197 字节)" WIDTH="393" HEIGHT="320"></p>
<p ALIGN="JUSTIFY">程序很简单,一共有两个框架(</font><font SIZE="3">Frame1</font><font FACE="宋体" SIZE="3">和</font><font SIZE="3">Frame2</font><font FACE="宋体" SIZE="3">),它们的</font><font SIZE="3">Caption</font><font FACE="宋体" SIZE="3">分别为“选择你的计算机拥有的配置”和“这是你的计算机系统”,在</font><font SIZE="3">Frame1</font><font FACE="宋体" SIZE="3">有四个检查框(</font><font SIZE="3">Check1</font><font FACE="宋体" SIZE="3">到</font><font SIZE="3">Check4</font><font FACE="宋体" SIZE="3">),</font><font SIZE="3">Caption</font><font FACE="宋体" SIZE="3">分别为“网络系统”、“鼠标”、“密码保护”和“电子邮件”,另把</font><font SIZE="3">Check4</font><font FACE="宋体" SIZE="3">的</font><font SIZE="3">Enabled</font><font FACE="宋体" SIZE="3">属性改为</font><font SIZE="3">False</font><font FACE="宋体" SIZE="3">,使其无效;在</font><font SIZE="3">Frame2</font><font FACE="宋体" SIZE="3">中放置四个图片框(</font><font SIZE="3">Picture1</font><font FACE="宋体" SIZE="3">到</font><font SIZE="3">Picture4</font><font FACE="宋体" SIZE="3">)与四个检查框向对应,请把所有图片框的</font><font SIZE="3">BorderStyle</font><font FACE="宋体" SIZE="3">属性设为</font><font SIZE="3">0</font><font FACE="宋体" SIZE="3">(无边框),它们的</font><font SIZE="3">Picture</font><font FACE="宋体" SIZE="3">属性请根据上图,在存放图标的目录中找到相对的图标。下面是程序代码:</font><font SIZE="3"></p>
<p ALIGN="JUSTIFY"><font color="#004080">Private Sub Check1_Click()</font></p>
<blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">If Check1.Value Then</font></p>
<blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">Check4.Enabled = -1<br>
Picture1.Visible = -1</font></p>
</blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">Else: Check4.Enabled = 0<br>
Picture1.Visible = 0<br>
Check4.Value = 0<br>
Picture4.Visible = 0</font></p>
<p ALIGN="JUSTIFY"><font color="#004080">End If</font></p>
</blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">End Sub</font></font><font FACE="宋体" SIZE="3"></p>
<p ALIGN="JUSTIFY"></font><font SIZE="3"> </p>
<p ALIGN="JUSTIFY"><font color="#004080">Private Sub Check2_Click()</font></p>
<blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">If Check2.Value Then</font></p>
<blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">Picture2.Visible = -1</font></p>
</blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">Else: Picture2.Visible = 0</font></p>
<p ALIGN="JUSTIFY"><font color="#004080">End If</font></p>
</blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">End Sub</font></font><font FACE="宋体" SIZE="3"></p>
<p ALIGN="JUSTIFY"></font><font SIZE="3"> </p>
<p ALIGN="JUSTIFY"><font color="#004080">Private Sub Check3_Click()</font></p>
<blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">If Check3.Value Then</font></p>
<blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">Picture3.Visible = -1</font></p>
</blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">Else: Picture3.Visible = 0</font></p>
<p ALIGN="JUSTIFY"><font color="#004080">End If</font></p>
</blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">End Sub</font></p>
<p ALIGN="JUSTIFY"> </p>
<p ALIGN="JUSTIFY"><font color="#004080">Private Sub Check4_Click()</font></p>
<blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">If Check4.Value Then</font></p>
<blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">Picture4.Visible = -1</font></p>
</blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">Else: Picture4.Visible = 0</font></p>
<p ALIGN="JUSTIFY"><font color="#004080">End If</font></p>
</blockquote>
<p ALIGN="JUSTIFY"><font color="#004080">End Sub</font></font><font FACE="宋体" SIZE="3"></p>
<p ALIGN="JUSTIFY"></font><img src="06-11.gif" alt="06-11.gif (4875 字节)" WIDTH="393" HEIGHT="320"><font FACE="宋体" SIZE="3"></p>
<p ALIGN="JUSTIFY">这个程序比我们见过的任何程序都简单,就不再做说明。</p>
<p ALIGN="JUSTIFY">(第六章</font><font SIZE="3"> </font><font FACE="宋体" SIZE="3">未完)</font></td>
</tr>
</table>
</center></div><p align="right"><strong><a href="#top"><img src="top2.gif" border="0" WIDTH="27" HEIGHT="30"></a></strong></td>
</tr>
</table>
</center></div>
<p> </p>
</body>
</html>
<!--webbot bot="HTMLMarkup" TAG="XBOT" StartSpan --></SCRIPT><!--webbot BOT="HTMLMarkup" endspan -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -