Delphi Regex之TPerlRegEx 類的屬性與方法(4): Replace

// Replacevar reg: TPerlRegEx;begin reg := TPerlRegEx.Create(nil); reg.RegEx := 'ab'; reg.Replacement := '◆'; reg.Subject := 'ababab'; reg.ReplaceAll; ShowMessage(reg.Subject); //返回: ◆◆◆ reg.Subject := 'ababab'; //下面四行程式, 相當於

再學 GDI+[88]: TGPImage(8) – 放大鏡

本例:代碼檔案:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) CheckBox1: TCheckBox; procedure FormCreate(Sender: TObject); procedure

Delphi 的繪圖功能[3] – 矩形類圖形

unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5:

多線程編程(12) – 多線程同步之 Semaphore (訊號對象)

之前已經有了兩種多線程的同步方法:CriticalSection(臨界區) 和 Mutex(互斥), 這兩種同步方法差不多, 只是範圍不同;CriticalSection(臨界區) 類似於只有一個蹲位的公用廁所, 只能一個個地進; Mutex(互斥) 對象類似於接力賽中的接力棒, 某一時刻只能一個人持有, 誰拿著誰跑.什麼是 Semaphore(訊號或叫訊號量)呢?譬如到銀行辦業務、或者到車站買票, 原來只有一個服務員, 不管有多少人排隊等候, 業務只能一個個地來.假如增加了業務視窗,

GdiPlus[6]: 五種畫刷總覽

GDI+ 有五種畫刷:實心畫刷: IGPSolidBrush陰影畫刷: IGPHatchBrush紋理畫刷: IGPTextureBrush線性漸層畫刷: IGPLinearGradientBrush路徑漸層畫刷: IGPPathGradientBrush它們分別有對應的實作類別:TGPSolidBrushTGPHatchBrushTGPTextureBrushTGPLinearGradientBrushTGPPathGradientBrush.五個畫刷都繼承自 IGPBrush, 但

INDY流的發送和接收

發送try    s := 'Hello world!';    stream := TStringStream.Create(s);    IdTCPClient1.OpenWriteBuffer;    IdTCPClient1.WriteInteger(stream.Size);//注意這裡:要先寫入流的長度,在讀取的時候如果使用      AThread.Connection.ReadStream(stream);    IdTCPClient1.WriteStream(stream,

控制錢箱,客顯,列印

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);   

多線程編程(3) – 多線程同步之 CriticalSection(臨界區)

"臨界區"(CriticalSection): 當把一段代碼放入一個臨界區, 線程執行到臨界區時就獨佔了, 讓其他也要執行此代碼的線程先等等; 這和前面用的 Lock 和 UnLock 差不多; 使用格式如下:var CS: TRTLCriticalSection; {聲明一個 TRTLCriticalSection 結構類型變數; 它應該是全域的}InitializeCriticalSection(CS); {初始化}EnterCriticalSection(CS); {開始:

Delphi Regex文法(1): 關於大小寫與中文

//替換一般字串var reg: TPerlRegEx;begin reg := TPerlRegEx.Create(nil); reg.Subject := '我愛DELPHI, 但Delphi不愛我!'; reg.RegEx := 'Delphi'; reg.Replacement := '◆'; reg.ReplaceAll; ShowMessage(reg.Subject); //返回: 我愛DELPHI, 但◆不愛我!

關於 Delphi 中流的使用(2) 用 TFileStream(檔案流) 讀寫

TStream 是一個抽象的基類, 不能直接產生對象. 在具體的應用中, 主要使用它的子孫類:TFileStream: 檔案流TStringStream: 字串流TMemoryStream: 記憶體流TResourceStream: 資源檔流THandleStream: 是 TFileStream 的父類、TStream 的子類TCustomMemoryStream: 是 TMemoryStream 和 TResourceStream 的父類、TStream 的子類與流相關的常用類還有:

Delphi 中的字串函數(6) – StrUtils 中的 Ansi 字串函數

//從左右兩端提取指定數目的字串: 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

SysUtils 中其他 PChar 函數: StrPas、StrNew、StrDispose、StrNextChar、StrFmt、StrLFmt、StrCharLength

//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}

再學 GDI+[56]: 路徑 – Warp

通過路徑的 Warp 方法可以讓路徑在一個範圍內(四個點決定的範圍)變換;第一個參數可以是 3 個點或 4 個點的數組, 如果是 3 個的數組, 那麼第 4 個點將自動跟隨一個平行四邊形;第二個參數用來指定點數組的個數, 本例就是通過這個參數控制了點的個數;第三個參數是一個矩形, 這個矩形應該是路徑的外接矩形, 之後的參數都是可選的;第四個參數也是一個矩陣變換, 因由專門的 例子 , 這裡沒有嘗試;第五個參數是 TWarpMode(WarpModePerspective,

使用 TListView 控制項(3)

本例:代碼檔案:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls;type TForm1 = class(TForm) ListView1: TListView; Button1: TButton; Button2: TButton; CheckBox1:

再學 GDI+[73]: 地區(2) – 地區運算

Intersect {交集}Union {聯合}Xor_ {減去交集}Exclude {減去}Complement {不相交}//GDI+ 的地區能和矩形、路徑、另一個地區三種對象進行運算.本例:代碼檔案:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,

Delphi 與 DirectX 之 DelphiX(4): 初識 TDXTimer

DelphiX 提供了高效能的計時器 TDXTimer, 使用方法和 Timer 基本一樣.我們在使用 Timer 時, 很少把 Interval 設為 50 以下(這應該是它精確度的極限);使用 TDXTimer 可以把 Interval 置為 0, 表示儘可能地快!本例:代碼檔案:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Delphi 與 DirectX 之 DelphiX(52): TDIB.DoSaturation();

本例:代碼檔案:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DIB, StdCtrls;type TForm1 = class(TForm) DXPaintBox1: TDXPaintBox; Button1: TButton; Button2: TButton; procedure

Delphi 的字元及字串[1] – string、AnsiString、WideString、String[n]、ShortString

//最常用的 stringvar str: string; {定義}begin str := '萬一'; {賦值} ShowMessage(IntToStr(Length(str))); {長度是: 4}end;//長字串 AnsiString; 在目前的版本(2007)中的預設狀態下, String 就是 AnsiStringvar str: AnsiString;begin str := '萬一'; ShowMessage(IntToStr(Length(str)));

GdiPlus[24]: IGPPrivateFontCollection: 分別從檔案和記憶體載入字型

IGPPrivateFontCollection.AddFontFile: 從檔案載入字型;IGPPrivateFontCollection.AddMemoryFont: 從記憶體載入字型AddFontFile 測試:uses GdiPlus;function GetFontsDirectory: string;var Len: Integer; buf: array[0..MAX_PATH-1] of Char;begin GetWindowsDirectory(buf, Length(

GdiPlus[50]: 映像(二) 關於 Create

IGPImage 類提供的 Create 方法:Image := TGPImage.Create(檔案(或流), Boolean);//其中的布爾值預設 False; 如果為 True 則使用檔案(或流)中的已嵌入顏色管理資訊來進行顏色校正.{ 樣本1: 從檔案建立 }var Graphics: IGPGraphics; Image: IGPImage;begin Image := TGPImage.Create('C:\GdiPlusImg\Grapes.jpg');

總頁數: 61357 1 .... 2837 2838 2839 2840 2841 .... 61357 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.