⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class_book_begin061.htm

📁 关于VB开发的教程
💻 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_begin062.htm">第二页</a> <a href="class_book_begin063.htm">第三页</a> <a href="class_book_begin064.htm">第四页</a><br>
    <a href="class_book_begin065.htm">第五页</a> <a href="../class_book.htm">返回</a> 
    &nbsp; </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"></font><font size="3">我们为什么要设计计算机程序呢,当然是为了计算机能为我们完成工作,但是要完成不同的任务,我们就必须对计算机下达命令,然后计算机在把信息返馈回来――任务是否完成。以上就是所谓的人机对话或交互功能,尤其是在Windows操作里我们需要进行更多的输入工作,我们需要填写各种各样的表格,设置程序的重要参数,把数据输入给计算机,再又它完成既定的工作就是今天我们本章要重点讨论的问题――在VB中如何建立完整的输入机制。</font></p>
        <p ALIGN="JUSTIFY"><font size="3">在VB中提供了一个函数InputBox能帮助我们建立一个最简单的输入窗体,语法如下:</font></p>
        <p ALIGN="JUSTIFY"><font color="#000080" size="3"><strong><em>InputBox(prompt[,title][,default][,xpos][,ypos][,helpfile,context])</em></strong></font></p>
        <p ALIGN="JUSTIFY"><font size="3">该函数返回一个字符串表达式,其参数含义为:(“[]”表示可缺省)</font></p>
        <blockquote>
          <p ALIGN="JUSTIFY"><font color="#000080" size="3"><strong><em>prompt――字符串表达式,最大长度为1024字符,窗体上的提示部分。</em></strong></font></p>
          <p ALIGN="JUSTIFY"><font color="#000080" size="3"><strong><em>Title――字符串表达式,显示标题栏里的文本。</em></strong></font></p>
          <p ALIGN="JUSTIFY"><font color="#000080" size="3"><strong><em>Default――字符串表达式,窗体中文本框的缺省值。</em></strong></font></p>
          <p ALIGN="JUSTIFY"><font color="#000080" size="3"><strong><em>xpos,ypos――数值表达式,以Twips为单位指定窗体出现在屏幕上的位置。</em></strong></font></p>
          <p ALIGN="JUSTIFY"><font color="#000080" size="3"><strong><em>helpfile――字符串表达式,是帮助文件的完整路径。</em></strong></font></p>
          <p ALIGN="JUSTIFY"><font color="#000080" size="3"><strong><em>Context――数值表达式,指定适合的帮助主题。</em></strong></font></p>
        </blockquote>
        <p ALIGN="JUSTIFY"><font size="3">可能你看了上面的说明并不明白,那么下面我们就用Input语句完成一个最简单的程序。</font></p>
        <p ALIGN="JUSTIFY"> </p>
        <blockquote>
          <p ALIGN="JUSTIFY"><font color="#FF0000" size="3"><strong><em>小知识:屏幕坐标</em></strong></font></p>
          <p ALIGN="JUSTIFY"><font color="#FF0000" size="3"><strong><em>在计算机的屏幕上也有一个类似于我们在中学里常用到的直角坐标系,之不过它的原点不在左下,而是在屏幕的右上角,屏幕的最右上方坐标为(0,0),它的横坐标和我们的习惯是一致的,而纵坐标则是越向下越大,不仅是屏幕,所有的对象里都是一样,需要记清。见图6-1</em></strong></font></p>
        </blockquote>
        <p ALIGN="JUSTIFY"><img src="06-01.gif" alt="06-01.gif (1479 字节)" WIDTH="300" HEIGHT="200"></p>
        <font FACE="宋体" SIZE="3"><p ALIGN="JUSTIFY"></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 + -