Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¡¶Delphi Ëã·¨ÓëÊý¾Ý½á¹¹¡·: ¹ØÓÚ const

Èç¹û²ÎÊýÔÚº¯ÊýÖв»¿ÉÄÜÐÞ¸Ä, Ò»¶¨ÒªÊ¹Óà const;
²»È», ±àÒëÆ÷¾Í»á:
¼Ù¶¨ÏÈÐÞ¸Ä, ÏÈÒª±¸·Ý; ʹÓÃÇ°ºóÒªÔö¼õÒýÓüÆÊý; »¹ÒªÌ×ÉÏ try finally.
Ö¸¶¨ÁË const ¾Í¿ÉÒÔ±ÜÃâÒÔÉϹý³Ì´Ó¶øÌá¸ßЧÂÊ.
unit
Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class
(TForm)
Button1: TButton;
procedure
Button1Click(Sender: TObject);
end
;
var
Form1: TForm1;
implementation
{$R *.dfm}
//ÅжÏÒ»¸ö×Ö·û´®ÖÐÊý×ֵĸöÊý
function
GetNum1(str: string
): Integer;
var
i: Integer;
begin
Result := 0
;
for
i := 1
to
Length(str) do
if
str[i] in
['0'
..'9'
] then
Inc(Result);
end
;
//ͬÑùµÄº¯ÊýÖ»ÊǸø²ÎÊý¼ÓÉÏ const
function
GetNum2(const
str: string
): Integer;
var
i: Integer;
begin
Result := 0
;
for
i := 1
to
Length(str) do
if
str[i] in
['0'
..'9'
] then
Inc(Result);
end
;
{¶Ô±È²âÊÔ}
procedure
TForm1.Button1Click(Sender: TObject);
var
s: string
;
n: Cardinal;
i: Integer;
begin
s := 'ABC123'
;
n := GetTickCount;
for
i := 0
to
1000000
do
GetNum1(s);
n := GetTickCount - n;
Text := IntToStr(n) + ' - '
;
n := GetTickCount;
for
i := 0
to
1000000
do
GetNum2(s);
n := GetTickCount - n;
Text := Text + IntToStr(n);
end
;
end
.


Ïà¹ØÎĵµ£º

ÓÃDelphi´ÓÄÚ´æÁ÷ÖÐÅжÏͼƬ¸ñʽµÄ´úÂë

ÀûÓÃÄÚ´æÁ÷À´ÅжÏÎļþµÄ¸ñʽ£¬ÆäʵÅжÏÎļþµÄÇ°¼¸¸ö×ֽھͿÉÒÔ¼òµ¥µÄÅжÏÕâ¸öÎļþÊÇʲôÀàÐ͵ÄÎļþ¡£
procedure TFrm.CheckImgType(Sender: TObject);  
var   //ÉùÃ÷±äÁ¿
   MyImage:TMemoryStream;   //ÄÚ´æÁ÷¶ÔÏó
   Buffer:Word;
   i:integer;
beg ......

delphiËæ»úÊäÈëÑéÖ¤Âë

ÊäÈëÑéÖ¤Âë Ò»¸öÎı¾¿ò 24×ÖĸËæ»ú³ö4¸ö×Öĸ È»ºóÓû§
ÊäÈëËùËæ»ú³öµÄ×Öĸ ÊäÈëÕýÈ· ½øÈë½çÃæ¡£¡£´íÎóÓÖËæ»úÏ¡£¡£¡£
*/
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
lbl1: TLabel;
Edit1: TEdit; ......

DelphiѹËõͼƬ´úÂë

Ìí¼ÓÒýÓãºuses JPEG;
//=====================ͼƬ´¦Àíº¯Êý£¬½«¸²¸ÇԭͼƬÎļþ===========================
//=====filename:ͼƬÍêÕû·¾¶  PressQuality:ѹËõÖÊÁ¿ Width:¿í  Height:¸ß
function CompressMainFun(filename: String; PressQuality,Width,Height:integer): Boolean;
var
  bmp: TBitmap ......

DelphiµÄ·¢Õ¹·½Ïò

¶Á“Delphi2010,DELPHIµÄÏ£Íû?”ÓиÐ
 
Ô­ÎÄ£ºhttp://www.gowjq.com/forum-29-1.html
 
 
1£©  Ê¢´óµÄÖ÷Òª¿ª·¢¹¤¾ßÊÇDelphi, Ïê¼û£º http://act.sdo.com/Delphi/£¬ ÓÎÏ·ÊÇÒ»ÖÖ¸´ÔÓ½»»¥½çÃæµÄ¿ª·¢£¬Delphi¿ÉÒÔʤÈΡ£Í¬Ñù×÷ΪÆóÒµÓ¦ÓõÄÇ°¶Ë£¬ÓÃDELPHI¿ª·¢Ò²ÊǺܺõÄÑ¡Ôñ¡£
2£©  Ò ......

¡¶Delphi Ëã·¨ÓëÊý¾Ý½á¹¹¡·: Êý¾Ý¶ÔÆë

ΪÁ˼ӿìÓ²¼þµÄ·ÃÎÊËÙ¶È, ±àÒëÆ÷ͨ³£ÒªÊ¹ÓÃ"Êý¾Ý¶ÔÆë", Æ©Èç:
//ÏÂÃæ½á¹¹ÖÐ: SizeOf(TRec) = 6; ÒòΪ b ÔÚÕâÀïÒ²ÒªÕ¼ 2 ×Ö½Ú.
TRec = record
a: Word;
b: Byte;
c: Word;
end
;
//ÏÂÃæ½á¹¹ÖÐ: SizeOf(TRec) = 16; ÕâÀïµÄ a ºÍ b ¹²Õ¼ÁË 8 ¸ö×Ö½Ú.
TRec = record
a: Byte;
b: Byte;
c: Do ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ