DelphiÔ´³ÌÐò¸ñʽÊéд¹æ·¶
1£¬¹æ·¶¼ò½é
¡¡¡¡±¾¹æ·¶Ö÷Òª¹æ¶¨DelphiÔ´³ÌÐòÔÚÊéд¹ý³ÌÖÐËùÓ¦×ñѵĹæÔò¼°×¢ÒâÊÂÏî¡£±àд¸Ã¹æ·¶µÄÄ¿µÄÊÇʹ¹«Ë¾Èí¼þ¿ª·¢ÈËÔ±µÄÔ´´úÂëÊéдϰ¹ß±£³ÖÒ»Ö¡£ÕâÑù×ö¿ÉÒÔʹÿһ¸ö×éÔ±¶¼¿ÉÒÔÀí½âÆäËü×éÔ±µÄ´úÂ룬ÒÔ±ãÓÚÔ´´úÂëµÄ¶þ´Î¿ª·¢¼ÇÒäϵͳµÄά»¤¡£
2£¬Ò»°ã¸ñʽ¹æ·¶
2.1 Ëõ½ø
¡¡¡¡Ëõ½ø¾ÍÊÇÔÚµ±Ô´³ÌÐòµÄ¼¶¸Ä±äʱΪÔö¼Ó¿É¶ÁÐÔ¶ø¶³öµÄÁ½¸ö¿Õ¸ñ¡£Ëõ½øµÄ¹æÔòΪÿһ¼¶Ëõ½øÁ½¸ö¿Õ¸ñ¡£²»×¼ÐíʹÓÃTab¡£ÒòΪTab»áÒòΪÓû§Ëù×÷µÄÉèÖò»Í¬¶ø²úÉú²»Í¬µÄЧ¹û¡£µ±Óöµ½begin »ò½øÈëÅжϡ¢Ñ»·¡¢Òì³£´¦Àí¡¢withÓï¾ä¡¢¼Ç¼ÀàÐÍÉùÃ÷¡¢ÀàÉùÃ÷µÈµÄʱºîÔö¼ÓÒ»¼¶£¬ µ±Óöµ½end»òÍ˳öÅжϡ¢Ñ»·¡¢Òì³£´¦Àí¡¢withÓï¾ä¡¢¼Ç¼ÀàÐÍÉùÃ÷¡¢ÀàÉùÃ÷µÈµÄʱºî¼õÉÙÒ»¼¶¡£ÀýÈ磺
if TmpInt <> 100 then
TmpInt := 100;
2.2 Begin..End
¡¡¡¡beginÓï¾äºÍendÓï¾äÔÚÔ´³ÌÐòÖÐÒª¶ÀÕ¼Ò»ÐУ¬ÀýÈç:
for I := 0 to 10 do begin //²»ÕýÈ·µÄÓ÷¨
end;
for I := 0 to 10 do //ÕýÈ·µÄÓ÷¨
begin
end;
2.3 ¿Õ¸ñ
¡¡¡¡ÔÚ²Ù×÷·û¼°Âß¼ÅжϷûºÅµÄÁ½¶ËÌí¼Ó¿Õ¸ñ£¬ÀýÈ磺I := I + 1;£¬a and b µÈ£¬µ«Ìí¼ÓÀ¨ºÅʱ²»ÐèÒª¿Õ¸ñ¡£ÀýÈ磺if ( a > b ) then //´íÎóµÄÓ÷¨
If (a > b) then //ÕýÈ·µÄÓ÷¨
ÓÖÀýÈ磺procedure Test(Param1: integer; Param3: string);
3. Object Pascal Óï·¨Êéд¸ñʽ¹æ·¶
3.1 ±£Áô×Ö
¡¡¡¡Object Pascal ÓïÑԵı£Áô×Ö»ò¹Ø¼ü´ÊӦȫ²¿Ê¹ÓÃСд×Öĸ¡£
3.2 ¹ý³ÌºÍº¯Êý
3.2.1ÃüÃû¼°¸ñʽ
¡¡¡¡¹ý³ÌºÍº¯ÊýµÄÃû³ÆӦȫ²¿Ê¹ÓÃÓÐÒâÒåµÄµ¥´Ê×é³É£¬²¢ÇÒËùÓе¥´ÊµÄµÚÒ»¸ö×ÖĸӦ¸ÃʹÓôóд×Öĸ¡£ÀýÈ磺
procedure formatharddisk;//²»ÕýÈ·µÄÃüÃû
procedure FormatHardDisk;//ÕýÈ·µÄÃüÃû
¡¡¡¡ÉèÖñäÁ¿ÄÚÈݵĹý³ÌºÍº¯Êý£¬Ó¦Ê¹ÓÃSet×÷Ϊǰ׺£¬ÀýÈ磺 procedure SetUserName;
¡¡¡¡¶ÁÈ¡±äÁ¿ÄÚÈݵĹý³ÌºÍº¯Êý£¬Ó¦Ê¹ÓÃGet×÷Ϊǰ׺£¬ÀýÈ磺function GetUserName: string;
3.2.2 ¹ý³ÌºÍº¯ÊýµÄ²ÎÊý
3.2.2.1̟̞
¡¡¡¡Í³Ò»ÀàÐ͵IJÎÊýдÔÚͬһ¾äÖÐ:¡¡ procedure Foo(Param1, Param2, Param3: Integer; Param4: string);
3.2.2.2̟̞
¡¡¡¡ ËùÓвÎÊý±ØÐëÊÇÓÐÒâÒåµÄ£»²¢ÇÒµ±²ÎÊýÃû³ÆºÍÆäËüÊôÐÔÃû³ÆÖØÁ˵Äʱºò£¬¼ÓÒ»¸öǰ׺‘A’, ÀýÈ磺
procedure SomeProc(AUserName: string; AUserAge: integer);
3.2.2.3ÃüÃû³åÍ»
¡¡¡¡µ±Ê¹ÓõÄÁ½¸öunitÖаüÀ¨Ò»¸öÖØÃûµÄº¯Êý»ò¹ý³Ìʱ, ÄÇçÛµ±ÄãÒýÓÃÕâÒ»º¯Êý»ò¹ý³Ìʱ£¬½«Ö´ÐÐÔÚuse ×Ó¾äÖкóÉùÃ÷µÄÄǸöunitÖеĺ¯Êý»ò¹ý³Ì¡£ÎªÁ˱ÜÃâÕâÖÖ&
Ïà¹ØÎĵµ£º
ÔÚDelphiÖеÄRecordÀàÐÍÖУ¬ÓëÖ®CÓïÑÔ¶ÔÓ¦µÄ¼´ÊǽṹÌåÀàÐÍ£¨struct
£©£¬Ò²¿ÉÄÜÊÇΪÁË·ûºÏCÓïÑÔ»òC++³ÌÐòÔ±µÄÏ°¹ß£¬¶ÔÓÚËüÔÚDelphiÖеÄÓ¦ÓôæÔÚµÄһЩÎÊÌâ½øÐгõ²½µÄ˵Ã÷¡£ÔÚDelphiÖеļǼÌåÀàÐÍÓÐÁ½ÖÖ·½Ê½¶¨Òå
Type
RecTest = record (packed
)
ID :integer; ......
dllÎļþ¼ò½é£º
ËüÊÇDynamic Link Library µÄËõдÐÎʽ£¬DLL ÊÇÒ»¸ö°üº¬¿ÉÓɶà¸ö³ÌÐòͬʱʹÓõĴúÂëºÍÊý¾ÝµÄ¿â£¬DLL²»ÊÇ¿ÉÖ´ÐÐÎļþ¡£¶¯Ì¬Á´½ÓÌṩÁËÒ»ÖÖ·½·¨£¬Ê¹½ø³Ì¿ÉÒÔµ÷Óò»ÊôÓÚÆä¿ÉÖ´ÐдúÂëµÄº¯Êý¡£º¯ÊýµÄ¿ÉÖ´ÐдúÂëλÓÚÒ»¸ö DLL ÖУ¬¸Ã DLL °üº¬Ò»¸ö»ò¶à¸öÒѱ»±àÒë¡¢Á´½Ó²¢ÓëʹÓÃËüÃǵĽø³Ì·Ö¿ª´æ´¢µÄº¯Êý¡£DLL »¹ÓÐÖúÓ ......
Delphi¼üÅÌ°´¼üαÂë
Ó÷¨£ºif key = chr(VK_RETURN) then...
³£ÊýÃû³Æ Ê®Áù½øÖÆÖµ Ê®½øÖÆÖµ ¶ÔÓ¦°´¼ü
VK_LBUTTON 01 1 Êó±êµÄ×ó¼ü
VK_RBUTTON 02 2 Êó±êµÄÓÒ¼ü
VK-CANCEL 03 3 Contol-break Ö´ÐÐ
VK_MBUTTON 04 4 Êó±êµÄÖмü£¨Èý°´¼üÊó±ê)
VK_BACK 08 8 Backspace¼ü
VK_TAB 09 9 Tab¼ü
VK_CLEAR 0C 12 Clear¼ü
VK ......