随笔分类 -  Delphi

摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceEcan{#regionChineseCalendarException///<summary>///中国日历异常处理///</summary>publicclassnewCalendarException:System.Exception{publicnewCalendarException(stringmsg):base(msg){}}#endregionpublicclassEcanChineseCalendar{#regio 阅读全文
posted @ 2011-03-08 17:23 EasyPass 阅读(653) 评论(0) 推荐(2)
摘要:这几个函数都包含在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 阅读全文
posted @ 2010-08-22 15:20 EasyPass 阅读(3746) 评论(0) 推荐(0)
摘要:1.单据中有多行数据,但预览时只显示部分内容,或者打印内容行与行之间有间隔FASTREPOR属性中:设置RowCount=0,Start New Page为False;Stretched为True.说明:RowCount:控制总共打印几行;RowCount=0是打印全部;Start New Page:打印前先跳页;每页打印一行;Stretch:表身自动伸缩根据表身内容;2.在打印中设置金额或数量的小数位数FASTREPOR属性中:使用DisplayFormat(数据显示格式)——数字——1234.50%2.0f:以整数形式显示;%2.2f:显示两位小数;%2.3f:显示三位小数位,可根据情况进 阅读全文
posted @ 2010-02-06 00:42 EasyPass 阅读(6127) 评论(0) 推荐(0)
摘要:1.String转化成PChar例:var str: string; pStr:PChar;...pStr := PChar(str);2.PChar转String例:varpStr:PChar; str:string;...str := strPas(pStr); 阅读全文
posted @ 2010-01-05 23:27 EasyPass 阅读(459) 评论(0) 推荐(0)
摘要:在DELPHI中指针最常见的就是和类TLIST结合起来使用。下面是一个很简单的例子,希望对这个例子的分析能让大家对使用TLIST类有一个简单的认识。代码的功能是使用指针和Tlist来生成一个牌串,并将牌串保存在t_CardInfo中。procedure TForm1.Button1Click(Sender: TObject);const //黑桃,红桃,方块,草花 CardType:array[0..3] of String = ('S','H','D','C');const //取出的牌数 CardNums = 4;type / 阅读全文
posted @ 2009-11-11 11:42 EasyPass 阅读(2420) 评论(0) 推荐(0)
摘要://十六进制(S)-->>十进制(I) [重写:Jey]function hextoint(s: string): Integer;begin //$代表16进制 Result:=StrToInt('$'+s);end;//十进制转换为二进制字符串 [重写:Jey]function inttoBin(i: integer): string;beginwhile i <>0 dobegin //i mod 2取模,再使用format格式化 result:=Format('%d'+result,[i mod 2]); i:=i div 2en 阅读全文
posted @ 2009-11-09 17:20 EasyPass 阅读(478) 评论(0) 推荐(0)