随笔 - 6  文章 - 129  trackbacks - 0
<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

常用链接

留言簿(14)

随笔档案(6)

文章分类(467)

文章档案(423)

相册

收藏夹(18)

JAVA

搜索

  •  

积分与排名

  • 积分 - 815445
  • 排名 - 49

最新评论

阅读排行榜

评论排行榜

delphi
Delphi遍历文件夹及子文件夹      摘要: 字符截取函数LeftStr, MidStr, RightStr
这几个函数都包含在StrUtils中,所以需要uses StrUtils;
假设字符串是 Dstr := ’Delphi is the BEST’, 那么
LeftStr(Dstr, 5) := ’Delph’
MidStr(Dstr, 6, 7) := ’i is th’
RightStr(Dstr, 6) := ’e BEST’

~~~~~~~~~~~~~~~~~~~~~~~~~
function RightStr
(Const Str: String; Size: Word): String;
begin
if Size > Length(Str) then Size := Length(Str) ;
RightStr := Copy(Str, Length(Str)-Size+1, Size)
end;
function MidStr
(Const Str: String  阅读全文
posted @ 2010-05-19 11:48 Ke 阅读(3497) | 评论 (0)  编辑
为TListBox组件添加水平滚动条      摘要: Delphi的TListBox组件会自动添加一个垂直滚动条,即当列表框的高度容纳不下所有的列表条目时,垂直滚动条就自动显示。但是,当条目的宽度大于列表框的宽度时,水平滚动条不会自动显示。当然, 可以在列表框中加如水平滚动条,方法是在窗体的OnCreate事件处理程序中加入如下代码:

procedure TForm1.FormCreate(Sender: TObject);

var

i, MaxWidth: integer;

begin

MaxWidth := 0;

for i := 0 to ListBox1.Items.Count - 1 do

if MaxWidth < ListBox1.Canvas.TextWidth(ListBox1.Items.Strings[i]) then

MaxWidth := ListBox1.Canvas.TextWidth(ListBox1.Items.Strings[i]);   阅读全文
posted @ 2010-05-19 11:45 Ke 阅读(328) | 评论 (0)  编辑
Delphi中Format与FormatDateTime函数详解      摘要: 总结一下Format的用法:

Format('x=%d',[12]);//'x=12'//最普通
Format('x=%3d',[12]);//'x=12'//指定宽度
Format('x=%f',[12.0]);//'x=12.00'//浮点数
Format('x=%.3f',[12.0]);//'x=12.000'//指定小数
Format('x=%8.2f'[12.0])//'x=12.00';
Format('x=%.*f',[5,12.0]);//'x=12.00000'//动态配置
Format('x=%.5d',[12]);//'x=00012'//前面补充0
Format('x=%.5x',[12]);//'x=0000C'//十六进制
Format('x=%1:d%0:d',[12,13]);//'x=1312'//使用索引
Format('x=%p',[nil]);//'x=00000000'//指针
Format('x=%1.1e',[12.0]);//'x=1.2E  阅读全文
posted @ 2010-05-19 10:08 Ke 阅读(29846) | 评论 (0)  编辑
Delphi+Codesoft 7.0      摘要: // 变量赋值
if chkParam.Checked then
begin
BarDoc.Variables.Item('var1').Value:= edtPN.Text;
BarDoc.Variables.Item('var2').Value:= edtPartName.Text;
BarDoc.Variables.Item('var3').Value:= edtDesc.Text;
end;

// 打印标签
Bardoc.Printlabel(seqty.Value);
// Feed
BarDoc.FormFeed;
// 关闭
Bardoc.Close;
BarApp.Quit;  阅读全文
posted @ 2010-05-14 08:12 Ke 阅读(1278) | 评论 (0)  编辑
ODAC的安装和使用(odac570src_0.28)      摘要: 第一步:在odac570src_0.28\Source\Delphi7打开dac70.dpk,然后编译

第二步:打开dacvcl70.dpk,然后编译

第三步:打开dcldac70.dpk,然后编译

第四步:打开odac70.dpk,然后编译
  阅读全文
posted @ 2010-05-06 20:10 Ke 阅读(1769) | 评论 (0)  编辑
Delphi 日誌記錄相關      摘要: //sDir:=ExtractFilePath(Application.ExeName)+'\';
ForceDirectories(sDir + 'TESTLOG');
sBackupFile := sDir + 'TESTLOG\'+FormatDateTime('YYYYMMDDHH',now())+'.log';
AssignFile(vFile, sBackupFile);
if FileExists(sBackupFile) then
Append(vFile)
else
Rewrite(vFile);  阅读全文
posted @ 2010-02-19 14:50 Ke 阅读(529) | 评论 (0)  编辑
Delphi 常用函數整理      摘要: Delphi提供的字符串函数里有一个Pos函数,它的定义是:

function Pos(Substr: string; S: string): Integer;

  它的作用是在字符串S中查找字符串Substr,返回值是Substr在S中第一次出现的位置,如果没有找到,返回值为0。  阅读全文
posted @ 2010-02-11 13:59 Ke 阅读(259) | 评论 (0)  编辑
AssignFile Procedure Assigns a file handle to a binary or text file      摘要: AssignFile
Procedure Assigns a file handle to a binary or text file  阅读全文
posted @ 2010-02-09 15:42 Ke 阅读(276) | 评论 (0)  编辑
Delphi快捷键
posted @ 2010-02-09 08:52 Ke 阅读(377) | 评论 (0)  编辑