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

📄 h20000424-19.htm

📁 对于学习很有帮助
💻 HTM
字号:
<html><head><script language="JavaScript">	function reset(){   for ( var i=0; i < document.Form1.elements.length; i++ )     { document.Form1.elements[i].options[0].selected=true }}function going(url){        parent.location=url;        reset();}</script><style><!--A:link {text-decoration: none; color: #000000; font-family: 宋体}A:visited {text-decoration: none; color: #000000; font-family: 宋体}A:active {text-decoration: none; font-family: 宋体}A:hover {text-decoration: underline:#ffffff; color: #ff0000}body,table {font-size: 9pt; font-family: 宋体}.H1 {font-size: 9pt ; line-height:9pt; align=center}.ourfont {font-size: 9pt ; line-height:9pt; }.ourfont1 {font-size: 9pt ; line-height:9pt; }--></style><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>LED数码管仿真显示程序</title></head><body topmargin="0" leftmargin="0"><div align="center"><center><table border="0" cellPadding="0" cellSpacing="0" width="700"><tbody>  <tr>    <td><p class="content4"><span class="font"><img border="0" height="3" src="../../soft/pix.gif" width="700"></span></td>  </tr></tbody></table></center></div><div align="center"><center><table border="0" cellPadding="0" cellSpacing="0" width="700"><tbody>  <tr>    <td bgColor="#3399ff" width="658"><p class="ourfont"><span class="font">&nbsp; </span><a style="text-decoration: none; color: rgb(255,255,255)" href="../os/H00705-2.htm">操作系统</a><font color="#FFFFFF"><span class="font"><span> |</span></span></font><a style="color: rgb(255,255,255); text-decoration: none" href="../image/H00705-14.htm">图像处理</a><font color="#FFFFFF"><span>|<span class="font"> </span></span></font><a style="color: rgb(255,255,255); text-decoration: none" href="../autoCAD/H00705-19.htm">辅助设计</a><span class="font"><font color="#FFFFFF"><span> | </span></font></span><a style="color: rgb(255,255,255); text-decoration: none" href="../data/H00705-18.htm">数     据 库</a><span class="font"><font color="#FFFFFF"><span> | </span></font></span><a style="color: rgb(255,255,255); text-decoration: none" href="H00706-1.htm">高级编程</a><span class="font"><font color="#FFFFFF"><span> | </span></font></span><a style="color: rgb(255,255,255); text-decoration: none" href="../netuse/H00705-20.htm">网络应用</a><font color="#FFFFFF"><span><span class="font"> | </span></span></font><a style="color: rgb(255,255,255); text-decoration: none" href="../webpage/H00705-21.htm">网页制作</a><font color="#FFFFFF"><span><span class="font"> |</span></span></font> <a style="color: rgb(255,255,255); text-decoration: none" href="../technic/H00706-3.htm">技术交流     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </a><a style="color: rgb(255,255,255); text-decoration: none" href="http://202.100.13.77/clslyb/default.asp?clsid=jiaoc"><font color="#FFFFFF"><strong>过客留言</strong></font></a></td>    <td bgColor="#3399ff" width="32"><p align="center" class="ourfont"><a href="mailto:net@163.sn.cn"><img src="../../soft/email.gif" alt="email.gif (493 字节)" border="0" WIDTH="20" HEIGHT="19"></a></td>  </tr></tbody></table></center></div><div align="center"><center><table border="1" cellSpacing="1" width="700" bordercolor="#3399FF"><tbody>  <tr>    <td align="left" bgColor="#FFFFFF" vAlign="top" width="700" bordercolor="#0000FF" bordercolorlight="#0000FF" bordercolordark="#0000FF"><p class="ourfont"> </p>    <p align="center">LED数码管仿真显示程序</p>    <table cellSpacing="0" cellPadding="0" width="1" border="0"><tbody>      <tr>        <td width="100%"><script language="javascript" src="http://proglib.webunion.com/share/proglib.js"></script> <script language="javascript" src="http://proglib.webunion.com/share/proglib1.js"></script> </td>      </tr></tbody>    </table>    <p> </p>    <p><font color="#ffffff">----</font> 在电子设备上广泛地使用LED数码管显示数据,在许多应用软件中也经常模拟LED数码管显示数据,使程序画面看起来很有特色。使用Delphi     程序实现LED数码管的仿真显示非常容易,具体步骤如下: </p>    <p><font color="#ffffff">----</font> 1.启动Delphi 4.0。在“Tools”工具菜单上选择Delphi的图象编辑器“Image     Editor”,建立一个新的位图,并设定位图的尺寸,宽为:48,高为:64。设定位图的底色为紫红色,前景色为红色。在位图上选择适当宽度的线条画出一个正方的8字,并将方型8字的各个拐角处用斜线断开,这样可使图象模拟的更加真实。完成后按文件名bitmap_0.bmp存储。然后用此文件复制9个文件,文件名分别为bitmap_1—9。用图象编辑器将这些方形的8字位图按文件名序号的顺序分别修改成0-9的数字位图,存储后备用。     </p>    <p><font color="#ffffff">----</font> 2.建立一个新的工程,在窗体Form1上添加“面板”元件Panel1,设定“面板”元件的属性:bevelouter=bmRaised;     bvevelInner=bvLowered; BorderWidth=4,设置后在Panel1元件上形成一个凸起的边框。在Panel1上添加一个“画板”元件PaintBox1,将PaintBox1的属性Hight     和Width设定为64和318,并适当调整Panel1面板的尺寸,使其正好包围画板元件。     </p>    <p><font color="#ffffff">----</font> 3.在窗体中添加一个“图象列表”元件ImageList1,在元件上双击鼠标,调出添加图象对话框,将先前制作好的位图bitmap_0至bitmap_9按顺序添加进图象列表元件中去,使图象列表中位图的序号与位图本身代表的数字相同,并注意将位图设定为不透明。     </p>    <p><font color="#ffffff">----</font> 4.转到单元编辑窗口,在Tform1的类说明部分添加一个显示LED的过程说明语句:     </p>    <p><font color="#ffffff">----</font> procedure display_LED(number:integer); 。 </p>    <p><font color="#ffffff">----</font> 在implementation语句下面添加一个全局变量和对应上面过程说明的过程体。内容如下:     </p>    <pre>implementation  {$R *.DFM}var  dis_number:integer;procedure Tform1.display_LED(number:integer);var  I:integer;  digital:array[0..5]of integer;begin   {限制显示位数小于6位}  if number&gt;999999 then number:=0;  for I:=0 to 5 do digital[I]:=0;  {分离数字位}  I:=0;  while (number)&gt;0 do  begin    digital[I]:=number mod 10;    number:=number div 10;    I:=I+1;  end;  {显示数字}  for I:=5 downto 0 do     imagelist1.draw(paintbox1.canvas, (5-I)*54,0,digital[I]);end;</pre>    <p><font color="#ffffff">----</font> 5.在Form1窗体的OnCreated     事件中输入语句:dis_number:=0; ,使显示的初始值为0。在画板元件的On     Paint 事件中输入语句:display_LED(dis_number);     ,此语句非常重要,它可以在初始启动时显示初值0,在窗口本身被覆盖后又恢复到前台时仍可显示正常的数值。至此已完成了显示函数的程序编制。在需要显示数字的程序中调用display_LED     函数就能将数字显示在LED 的仿真显示板上。本举例程序只显示6位以下的数字。     </p>    <p><font color="#ffffff">----</font> 6.为了测试显示效果,我们在窗体上增加一个编辑框元件Edit1,和一个按钮元件button1。用鼠标双击按钮元件跳转到Click事件编辑窗口,输入如下语句:     </p>    <pre>  dis_number:=strTOint(Edit1.text);  display_LED(dis_number);</pre>    <p><font color="#ffffff">----</font> 完成后按F9键编译并运行程序。在运行窗口的编辑框中输入6位以下的整数数字,点击按钮,编辑框中的数字就显示在LED仿真显示板上。     </td>  </tr></tbody></table></center></div><hr align="center" SIZE="1" width="700"><p align="center" class="ourfont"><span><span><font color="#000000">&nbsp; <a style="color: rgb(0,0,0); text-decoration: none" href="../../soft/network/index.htm">互联网络</font><font color="#FFFFFF"> </font></a><font color="#000000">|</span></span><a href="../../soft/system/index.htm" style="color: rgb(0,0,0); text-decoration: none">系统工具</a><span>|<span> <a href="../../soft/tools/index.htm" style="color: rgb(0,0,0); text-decoration: none">实用工具</a> | <a href="../../soft/multimedia/index.htm" style="color: rgb(0,0,0); text-decoration: none">媒体工具</a> | <a href="../../soft/image/index.htm" style="color: rgb(0,0,0); text-decoration: none">图形图像</a> | <a href="../../soft/game/index.htm" style="color: rgb(0,0,0); text-decoration: none">游戏娱乐</a> | </span><a href="../../soft/usesoft/index.htm" style="color: rgb(0,0,0); text-decoration: none">软件<span>使用</a></font><font color="#FFFFFF"> |</font>&nbsp; </span></span></p><hr align="center" SIZE="1" width="700"><font color="#FFE8BB"><p align="center" class="ourfont"></font><font color="#000000"><span><span>&copy;&nbsp;Copyright 2000 </span></span>陕西公用计算机互联网信息中心<span><span> 版权所有 </font></p></span></span><p align="center" class="ourfont"><font color="#000000"><span><span>本站制作维护by <a style="color: rgb(0,0,0)" href="mailto:haiyuan@163.sn.cn">HAIYUAN</a></span></span></font></p><p align="center" class="ourfont"><font color="#000000"><span><span>电话:(029)8371051 8371055 8371049 联系信箱:<a href="mailto:net@163.sn.cn">net@163.sn.cn</a></span></span></font></p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -