學用 TStringGrid [1] – ColCount、RowCount、Cells

本例功能:1、擷取 StringGrid 的行數、列數;2、給單元賦值.運行://範例程式碼:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Grids;type TForm1 = class(TForm) StringGrid1: TStringGrid; Panel1

學用 TStringGrid [3] – Cols、Rows

須知: TStringGrid 的每行、每列都是一個 TStrings 對象.本例功能:1、分別按列與行修改;2、分別按列與行讀取運行://本例代碼:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Grids;type TForm1 = class(TForm)

學用 TStringGrid [4] – ColWidths、RowHeights

本例功能:1、調整單元寬度;2、調整單元高度.運行://本例代碼:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Grids;type TForm1 = class(TForm) StringGrid1: TStringGrid; Panel1: TPanel;

學用 TStringGrid [5] – FixedCols、FixedRows、Color、FixedColor

本例運行://範例程式碼:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Grids;type TForm1 = class(TForm) StringGrid1: TStringGrid; Panel1: TPanel; Button1: TButton;

學用 TStringGrid [6] – Options

本例運行:一般修改 TStringGrid 的 Options 直接在設計時選一下 True 或 False 就行了; 代碼中可以像下面操作: StringGrid1.Options := [goFixedVertLine]; StringGrid1.Options := [goFixedVertLine, goVertLine, goColSizing];做完這個例子發現不太初級了, 但代碼很簡單:unit Unit1;interfaceuses Windows, Messages,

學用 TStringGrid [7] – ColWidths[0]、RowHeights[0]、GridLineWidth

本例:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Grids;type TForm1 = class(TForm) StringGrid1: TStringGrid; Panel1: TPanel; Button1: TButton; Button2:

學用 TStringGrid [8] – 字型列表

本例:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Grids;type TForm1 = class(TForm) StringGrid1: TStringGrid; procedure StringGrid1Click(Sender: TObject);

學用 TStringGrid [9] – OnDrawCell

本例:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Grids;type TForm1 = class(TForm) StringGrid1: TStringGrid; Panel1: TPanel; Button1: TButton; Button2:

談談 Delphi 的類型與指標[1]

先聲明: 不要把我說的這些個東西當作教科書, 這都是自己的淺見; 同時希望得到指正.Delphi 的指標分為 "類型指標" 和 "無類型指標" 兩類.Delphi 中的類型, 常用的也得有幾百個, 我們可以給每種類型定義相應的類型指標.其實 Delphi 已經為很多類型預定義了指標, 譬如資料類型: Integer 有對應的 PInteger;Char 有對應的 PChar;string 有對應的 PString;再譬如: TPoint 有對應的 PPoint;TColor 有對應的

WinAPI: QueryPerformanceFrequency – 擷取高效能定時器的每秒頻率數

//聲明:QueryPerformanceFrequency( var lpFrequency: TLargeInteger {此參數擷取定時器每秒的頻率數; TLargeInteger = Int64}): BOOL; {返回 False 表示硬體不支援高效能定時器}//舉例:var i: Int64;begin if QueryPerformanceFrequency(i) then ShowMessage(IntToStr(i))

使用鉤子函數[2]

鉤子函數雖然不多, 但其參數複雜, 應該從參數入手才能深入進去.UnhookWindowsHookEx 只需要 SetWindowsHookEx 返回的鉤子控制代碼作參數, 這個簡單;先看看 SetWindowsHookEx 的聲明:SetWindowsHookEx( idHook: Integer; {鉤子類型} lpfn: TFNHookProc; {函數指標} hmod: HINST; {包含鉤子函數的模組(EXE、DLL)的控制代碼} dwThreadId:

WinAPI: QueryPerformanceCounter – 擷取高效能定時器的當前值

//聲明:QueryPerformanceCounter( var lpPerformanceCount: TLargeInteger {擷取定時器每秒的頻率數; TLargeInteger = Int64}): BOOL; {返回 False 表示調用失敗, 或者是硬體不支援高效能定時器}//一個有趣的樣本: 判斷你的滑鼠滑鼠鍵按兩下速度; 我的最快記錄是 151 毫米var n1,n2,n,f: Int64; b: Boolean;procedure

使用鉤子函數[3] – 建立一個全域的滑鼠鉤子

分兩步:一、建立 DLL, 並在 DLL 實現鉤子的設定、釋放和鉤子函數;二、再建一個工程調用測試.第一步: 做 DLL先建立一個 DLL 工程, 自動初始的代碼如下(去掉注釋了):library Project1;uses SysUtils, Classes;{$R *.res}beginend.//把工程儲存為 MyHook.dpr, 並實現如下:library MyHook;uses SysUtils, Windows, {鉤子函數都來自 Windows 單元}

WinAPI: SetTimer、KillTimer – 建立與移除高效能定時器

//建立定時器函數的聲明:SetTimer( hWnd: HWND; {與定時器相關聯的視窗控制代碼} nIDEvent: UINT; {指定一個非 0 的定時器標識符} uElapse: UINT; {指定間隔時間, 單位是毫秒} lpTimerFunc: TFNTimerProc {每到時間後, 要調用的函數的指標}): UINT; {返回定時器標識符; 失敗返回

為鉤子的下一步學習補課: 如何提取 32 位中的某一位

Integer 類型是 32 位的, 有 4 個位元組, 現在我們需要能夠提取出其 32 位中的某一位.但 Delphi 最小的整數類型也是一個位元組(8位)的: Byte(無符號)、Shortint(有符號).要不先從提取一個位元組開始:var i: Integer; b: Byte;begin i := MaxInt; {Integer 的最大值} ShowMessage(IntToStr(i)); {2147483647} {現在 i 的二進位表示是: 01111111 1111

色彩轉換函數: 從 Delphi 到 Html

{由 Delphi 的顏色常數轉換到 Html 顏色}function HexColorToHtmlColor(c: Integer): string;var R,G,B: Byte;begin R := c and $FF; G := (c shr 8) and $FF; B := (c shr 16) and $FF; Result := #35 + Format('%.2x%.2x%.2x',[R,G,B]);end;{從十六進位字串轉換到 Html 顏色}function

WinAPI: AddAtom、DeleteAtom、FindAtom、GetAtomName、GlobalAddAtom、GlobalDeleteAtom、GlobalFindAtom、Global

這是儲存字串的一組 API.通過 AddAtom 儲存一個字串, 返回一個 ID;GetAtomName 通過這個 ID 可返回儲存的字串;還可以用 FindAtom 尋找、用 DeleteAtom 刪除已儲存的字串.這個儲存區有分本地(程式級)和全域(系統級)兩種, 帶 Global 首碼的是全域的[但在 Win32 下它們是否還有區別還有待考究].表中的字串不分大小寫, 如果重名過來, 會增加一個 ID 引用, 但會使用最先來的字串.//聲明:AddAtom( lpString:

控制項的 Parent 屬性示範

unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;type TForm1 = class(TForm) Panel1: TPanel; Button1: TButton; procedure Button1Click(Sender: TObject);

控制項的 Owner 屬性示範

unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;type TForm1 = class(TForm) Panel1: TPanel; Button1: TButton; Button2: TButton; procedure

Delphi 的字元及字串[2] – Char、AnsiChar、WideChar、PChar、PAnsiChar、PWideChar

//單字元 Char、AnsiChar (在目前版本(2007)中, 它們是一回事, 只有 1 位元組大小)var c: Char; {Char 類型的取值範圍是: #0..#255, 用十六進位表示是: #$0..#$FF}begin {用十進位方式賦值:} c := #65; ShowMessage(c); {A} {用十六進位方式賦值:} c := #$41; ShowMessage(c); {A} {用 Chr 函數代替 # 符號} c := Chr(65);

總頁數: 61357 1 .... 4792 4793 4794 4795 4796 .... 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.