Time of Update: 2018-12-07
unit AdoconnectPool;interfaceuses Classes, Windows, SyncObjs, SysUtils, ADODB;type TADOConnectionPool = class(TObject) private FObjList:TThreadList; FTimeout: Integer; FMaxCount: Integer; FSemaphore: Cardinal; FConnectionString:
Time of Update: 2018-12-07
分類運算子操作運算元結果類型範例算術運算子+加整數,實數整數,實數X + Y-減整數,實數整數,實數Result - 1*乘整數,實數整數,實數P * InterestRate/實數除整數,實數實數X / 2div整數除整數整數Total div UnitSizemod模數整數整數Y mod 6+(一元)符號等同整數,實數整數,實數+7-(一元)符號相反整數,實數整數,實數-X布林運算子not否定布爾型Booleannot (C in MySet)and與布爾型BooleanDone and (
Time of Update: 2018-12-07
// Replacevar reg: TPerlRegEx;begin reg := TPerlRegEx.Create(nil); reg.RegEx := 'ab'; reg.Replacement := '◆'; reg.Subject := 'ababab'; reg.ReplaceAll; ShowMessage(reg.Subject); //返回: ◆◆◆ reg.Subject := 'ababab'; //下面四行程式, 相當於
Time of Update: 2018-12-07
本例:代碼檔案:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Spin, ExtCtrls;type TForm1 = class(TForm) Panel1: TPanel; Label1: TLabel; Label2: TLabel; SpinEdit1:
Time of Update: 2018-12-07
不是 TColor, 是 TAlphaColor 了.TAlphaColor = type Cardinal; 還是一個整數.四個位元組分別是: AA RR GG BB(透明度、紅、綠、藍); 這和 TColor 的顏色序相反, 並增加了透明度.在 HD 表單上添加一個 TRectangle 和三個 TButton, 測試://下面四種賦值方法相同procedure TForm1.Button1Click(Sender: TObject);begin
Time of Update: 2018-12-07
TBitmap 主要成員:{ 方法 }SetSize(); //設定大小Clear(); //取消, 就是用指定顏色覆蓋ClearRect(); //覆蓋指定矩形範圍, 預設覆蓋為透明色BitmapChanged(); //重新整理改變IsEmpty(); //是否為空白UpdateHandles(); //將 Handles
Time of Update: 2018-12-07
當我第一次讀取 Form1.StyleLookup 並期待出現 "formstyle" 時, 給的確是 "backgroundstyle" ...現在明白了, 原來表單上覆蓋著一個 TRectangle 對象:uses FMX.Objects;procedure TForm1.Button1Click(Sender: TObject);begin (Self.Children[0] as TRectangle).Fill.Color := claRed; //預設情況下, 通過
Time of Update: 2018-12-07
const i = 1;//初始測試資料procedure TForm1.FormCreate(Sender: TObject);begin ListBox1.Items.CommaText := 'aaa,bbb,ccc'; ComboBox1.Items.CommaText := 'aaa,bbb,ccc';end;//對 ListBox1procedure TForm1.Button1Click(Sender: TObject);begin//
Time of Update: 2018-12-07
自由FREE:記憶體頁既沒有提交也沒有被保留。它不能被進程訪問,但是可以供某個記憶體配置函數分配。 保留RESERVED:記憶體已經被調用進程保留,不能被其他進程或者線程使用。但是記憶體並沒有被使用,也沒有提交到實體儲存體器。 提交COMMITTED:記憶體已經被提交到實體儲存體器。記憶體標識為正在被使用。只有分配它的進程才可以使用該記憶體。
Time of Update: 2018-12-07
修改StdRegComps.pas單元1.添加引用單元進來uses {$IFDEF EHLIB} DBGridEh, PrnDbgeh, GridsEh, DBCtrlsEh, {$ENDIF} {$IFDEF DBANYWHERE} remotestoredproc, remoteupdatesql, remoteudpconnection, remoteudpdataset, applicationupdate, remotetcpconnection,
Time of Update: 2018-12-07
發送try s := 'Hello world!'; stream := TStringStream.Create(s); IdTCPClient1.OpenWriteBuffer; IdTCPClient1.WriteInteger(stream.Size);//注意這裡:要先寫入流的長度,在讀取的時候如果使用 AThread.Connection.ReadStream(stream); IdTCPClient1.WriteStream(stream,
Time of Update: 2018-12-07
1、控制POS機的客戶顯示屏procedure TFrmMain.ShowMoney(Money_Port: String;Money_String:String);//Moneey_Port 顧顯介面Com1 or Com2 Money_String 顧顯顯示的內容var PrnFileName:TextFile;begin Assignfile(PrnFileName,Money_Port);
Time of Update: 2018-12-07
"臨界區"(CriticalSection): 當把一段代碼放入一個臨界區, 線程執行到臨界區時就獨佔了, 讓其他也要執行此代碼的線程先等等; 這和前面用的 Lock 和 UnLock 差不多; 使用格式如下:var CS: TRTLCriticalSection; {聲明一個 TRTLCriticalSection 結構類型變數; 它應該是全域的}InitializeCriticalSection(CS); {初始化}EnterCriticalSection(CS); {開始:
Time of Update: 2018-12-07
//替換一般字串var reg: TPerlRegEx;begin reg := TPerlRegEx.Create(nil); reg.Subject := '我愛DELPHI, 但Delphi不愛我!'; reg.RegEx := 'Delphi'; reg.Replacement := '◆'; reg.ReplaceAll; ShowMessage(reg.Subject); //返回: 我愛DELPHI, 但◆不愛我!
Time of Update: 2018-12-07
TStream 是一個抽象的基類, 不能直接產生對象. 在具體的應用中, 主要使用它的子孫類:TFileStream: 檔案流TStringStream: 字串流TMemoryStream: 記憶體流TResourceStream: 資源檔流THandleStream: 是 TFileStream 的父類、TStream 的子類TCustomMemoryStream: 是 TMemoryStream 和 TResourceStream 的父類、TStream 的子類與流相關的常用類還有:
Time of Update: 2018-12-07
//從左右兩端提取指定數目的字串: AnsiLeftStr、AnsiRightStrvar ss,s: AnsiString;begin ss := 'abcdefg'; s := AnsiLeftStr(ss, 2); ShowMessage(s); {ab} s := AnsiRightStr(ss, 2); ShowMessage(s); {fg}end;//從指定位置開始提取指定長度的字串: AnsiMidStrvar ss,s: AnsiString;begin ss
Time of Update: 2018-12-07
//StrPas: 轉換 PChar 為 string; 現在可以直接賦值, 很少用了.var p: PChar; s: string;begin p := 'Delphi'; s := StrPas(p); ShowMessage(s); {Delphi}end;//StrNew、StrDispose: 建立與銷毀 PChar.var p: PChar;begin p := StrNew('Delphi'); ShowMessage(p); {Delphi}
Time of Update: 2018-12-07
問題來源: http://www.cnblogs.com/del/archive/2008/11/27/967440.html#1384363unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton;
Time of Update: 2018-12-07
Intersect {交集}Union {聯合}Xor_ {減去交集}Exclude {減去}Complement {不相交}//GDI+ 的地區能和矩形、路徑、另一個地區三種對象進行運算.本例:代碼檔案:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,
Time of Update: 2018-12-07
DelphiX 提供了高效能的計時器 TDXTimer, 使用方法和 Timer 基本一樣.我們在使用 Timer 時, 很少把 Interval 設為 50 以下(這應該是它精確度的極限);使用 TDXTimer 可以把 Interval 置為 0, 表示儘可能地快!本例:代碼檔案:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,