摘要: delphi 换行操作我将我的商用《旅行社管理系统》的 发团通知 部分奉献给您,望对您有所帮助。 procedure TFrmMain.N327Click(Sender: TObject); var FWord :Variant; FDoc :Variant; strSQL :string; begin //首先创造对象,如果出现异常就做出提示 try FWord := CreateOleObject('Word.Application'); //WOrd程序的执行是否可见,值为false时,程序在后台运行。 FWord.Visible := True; except mess 阅读全文
posted @ 2013-10-21 13:13 麦麦提敏 阅读(942) 评论(0) 推荐(0) 编辑
摘要: 先看一个非多线程的例子, 代码执行时不能进行其它操作(譬如拖动窗体):{自定义方法: 在窗体上绘制...}procedure MyMethod;var i: Integer;begin for i := 0 to 500000 do begin Form1.Canvas.Lock; Form1.Canvas.TextOut(10, 10, IntToStr(i)); Form1.Canvas.Unlock; end;end;{调用上面的自定义方法}procedure TForm1.Button1Click(Sender: TObject);begin MyMethod;end;修改为多线... 阅读全文
posted @ 2013-10-21 11:28 麦麦提敏 阅读(335) 评论(0) 推荐(0) 编辑
摘要: XP 之后, Delphi 动注册表不方便了...逼出来一个办法:手头的程序需要修改注册表, 以让当前程序成为某格式的默认打开程序并关联图标; Vista 之后需要管理员权限才能操作注册表, 很麻烦, 所以有了下面的尝试.unit Unit1;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;type TForm1 =... 阅读全文
posted @ 2013-10-21 11:14 麦麦提敏 阅读(320) 评论(0) 推荐(0) 编辑
摘要: STA 单元 (用到 System.SysUtils.TStringHelper):------------------------------------------------------------------------------------------------------------------------------------------unit STA;interfaceuses System.SysUtils, System.Classes;type TSta = record FSeparator: Char; FArr: TArray>; con... 阅读全文
posted @ 2013-10-21 10:58 麦麦提敏 阅读(372) 评论(0) 推荐(0) 编辑
摘要: 以前写代码, 总是把主单元弄得满满当当; 现在更喜欢把控件比较独立的功能写成一个单元, 改写属性、重载方法...哪怕只有一点点和默认不同, 也喜欢独立出来.刚刚用到 TListBox, 需要能拖动元素、双击删除.------------------------------------------------------------------------------------------------------------------------------------------------unit ListBox2;interfaceuses System.Classes, Vcl.C. 阅读全文
posted @ 2013-10-21 10:54 麦麦提敏 阅读(268) 评论(0) 推荐(0) 编辑
摘要: uses Winapi.msxml, System.DateUtils;//实时获取网络时间的函数, 得到的是格林威治时间; 默认从 sohu 服务器获取, 因为它最快, 平均只需 15 毫秒function GetNetTime(aUrl: WideString = 'http://www.sohu.com'): string;begin with CoXMLHTTP.Create do begin open('Post', aUrl, False, EmptyParam, EmptyParam); send(EmptyParam); Result := ge 阅读全文
posted @ 2013-10-21 10:48 麦麦提敏 阅读(286) 评论(0) 推荐(0) 编辑