📄 h20000419-41.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>如何在Delphi4 BDE中配置Access数据库?</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"> </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">技术交流 </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">如何在Delphi4 BDE中配置Access数据库 <br> <br> (福建 许晓明) </p> <p><br> <br> 在使用Netscape的navigator时不知你有没有注意到:在它的状态栏有一组按钮,这使我们能很方便地打开另一个窗体,更有效地利用时间(要知道网上冲浪时间就是金钱啊!)。<br> 接下来我要讲的是如何在我们的程序中加入此功能,我们可以用DELPHI很轻易地实现,在DELPHI中我们可以指定某个Twincontrol类(如Ttoolbar)的父级为另一个Twincontrol(这里是Tstatusbar),然后通过动态创建Ttoolbar就可以在Tstarbar上创建TToolbar了,并且为工具条(Toolbar)添加按钮及其事件,通过调用API中的winexec实现对Window的应用程序的调用。下面给出了详细的代码和注释给大家分享。<br> unit superbar;<br> interface<br> uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, <br> Dialogs,ComCtrls;<br> type<br> TForm1 = class(TForm)<br> StatusBar1: TStatusBar;{为窗体添加一个状态栏}<br> procedure FormCreate(Sender: TObject);<br> private<br> {声明以下过程}<br> procedure createsuperbar(sender:Tobject;Imagelist:TImagelist);<br> {创建工具条}<br> procedure createbutton(toolbar:TToolbar;Const ButtonCaptions: array of String);<br> {创建工具条的按钮}<br> procedure superbuttonclick(sender:Tobject);<br> {为工具条按钮添加事件}<br> public<br> end;<br> var<br> Form1: TForm1;<br> toolbar:TToolbar;<br> implementation<br> uses shellapi,commctrl;{注意要加入此句,否则程序运行无法通过}<br> {$R *.DFM}<br> procedure TForm1.createsuperbar(sender:Tobject;Imagelist:Timagelist);<br> begin<br> toolbar:=TToolbar.Create(self);{动态创建一个工具条}<br> with toolbar do<br> begin<br> parent:=statusbar1;{定义toolbar的父类为状态栏,这样就可以创建出状态栏的工具条了}<br> top:=1;left:=1;height:=18;<br> buttonheight:=16;buttonwidth:=16;{定出toolbar和toolbutton的宽度长度};<br> flat:=true;autosize:=true; {设置toolbutton为浮动形式}<br> images:=imagelist;{设置toolbutton的图标}<br> {使工具条可以脱离状态栏.注意:如果你用的是DELPHI3.0需删除此两句,即可用}<br> dragkind:=dkdock;<br> dragmode:=dmautomatic;<br> end;<br> end;<br> procedure TForm1.createbutton(Toolbar:TToolbar;Const ButtonCaptions: array of String);<br> var<br> I,m: Integer;<br> begin<br> m:=0;<br> for I := 0 to High(ButtonCaptions) do<br> begin<br> with TToolButton.Create(ToolBar) do<br> begin<br> Parent := ToolBar;<br> Caption := ButtonCaptions[I];<br> onclick:=superbuttonclick;{为toolbutton增加鼠标click事件}<br> if (ButtonCaptions[I]=‘|’) then{判断是不是分隔符}<br> begin<br> Style := tbsSeparator;<br> m:=m+1;<br> end<br> else<br> begin<br> Style := tbsButton;<br> imageindex:=i-m;<br> end;<br> end;<br> end;<br> end;<br> {这里是响应鼠标事件,实现应用程序的打开}<br> procedure TForm1.superbuttonclick(sender:Tobject);<br> begin<br> winexec(pchar((sender as TToolbutton).caption),SW_ShowNormal);<br> {打开一个Windows的应用程序}<br> end;<br> procedure TForm1.FormCreate(Sender: TObject);<br> const<br> ExeList:array[0..2] of String=(<br> ‘winfile.exe’,<br> ‘|’,<br> ‘notepad.exe’);{可以在这里加上其它应用程序的全称,也可以不要分隔符}<br> var<br> imagelist:Timagelist;<br> i:integer;<br> begin<br> imagelist:=Timagelist.Create(self);<br> try{加入安全代码,也可不加}<br> for i:=0 to high(exelist) do<br> if exelist[i] <> ‘|’ then<br> begin<br> ImageList_AddIcon(ImageList.Handle,ExtractIcon(Handle,PChar(ExeList[i]),0));<br> {为imagelist添加图标}<br> end;<br> createsuperbar(self,imagelist);<br> createbutton(toolbar,exelist);<br> finally<br> end;<br> end;<br> end.<br> 以上程序已在Pentium-MMX166 32M Windows 98 DELPHI 4.0 通过,小弟反复测试没有问题,才斗胆拿出来与大家分享,如有问题望广大Delphi迷能给小弟多提意见,在下将翘首期待你的来信。 </td> </tr></tbody></table></center></div><hr align="center" SIZE="1" width="700"><p align="center" class="ourfont"><span><span><font color="#000000"> <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> </span></span></p><hr align="center" SIZE="1" width="700"><font color="#FFE8BB"><p align="center" class="ourfont"></font><font color="#000000"><span><span>© 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 + -