目前分類:Delphi (7)

瀏覽方式: 標題列表 簡短摘要
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Image1: TImage;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure imgTestClick(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.imgTestClick(Sender: TObject);
begin
  MessageDlg('Test Timage event', mtInformation, [mbOK], 0);
end;

procedure testCustomEvent;
var
  img: TImage;
begin
  img := TImage.Create(Form1); // 建立TImage物件
  img.Parent := Form1; // 顯示在Form上
  img.Top := 0; // 放在左上角
  img.Left := 0;
  // 指定自訂事件,如果是大量建立注意不要指定Name屬性,沒設定好自訂事件會編譯錯誤
  img.OnClick := Form1.btnTestClick;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  // 建立物件前的元件數
  ShowMessage(IntToStr(Self.ComponentCount));
  testCustomEvent;
  // 建立物件後的元件數
  ShowMessage(IntToStr(Self.ComponentCount));
end;

end.

bagatelles 發表在 痞客邦 留言(0) 人氣()

Source: http://delphi.ktop.com.tw/board.php?cid=16&fid=108&tid=23846

bagatelles 發表在 痞客邦 留言(0) 人氣()


bagatelles 發表在 痞客邦 留言(0) 人氣()

測試Delphi XE4的字串函數與正則表示法速度。

Function time: 46, Count=2023

bagatelles 發表在 痞客邦 留言(0) 人氣()

Delphi XE4的新功能,在宣告String後就相當於一個物件,有一些方法可以操作,像是常用的Length, ToLower, ToUpper等方法,與Java, C#之類的語言相同。之前的版本是使用function/procedure進行這些操作,所以寫個測試程式看看速度相差多少。

  

bagatelles 發表在 痞客邦 留言(0) 人氣()

連結

http://www.360doc.com/content/10/0818/20/2071424_47030551.shtml

bagatelles 發表在 痞客邦 留言(0) 人氣()

1. 如果在Project -> Options會出現Accss violation,可以用這個方法。

http://www.wretch.cc/blog/jhystart/15056819

bagatelles 發表在 痞客邦 留言(0) 人氣()