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

Delphi Assigned


1.¸ù¾Ý Delphi Ö¸Áî²Î¿¼ÊÖ²áÖÐ
˵Ã÷£º
Assigned º¯Ê½ÔÚ²ÎÊý²»Îªnilʱ´«»ØTrue,±íʾָÕëÒѾ­Ö¸µ½Ä³¸öÄÚ´æµØÖ·£¬Õâ¸öÄÚ´æµØÖ·¿ÉÄÜÊÇÒ»¸ö¶ÔÏóµØÊ×µØÖ·£¬Ò²¿ÉÄÜÔÚº¯Êý»ò¹ý³ÌÖУ¬ÉùÃ÷Ò»¸öÖ¸Õë±äÁ¿£¬Ã»Óи³ÖµÎªnil £¬ÎÞÂÒµÄÖ¸Ïòij´¦£¬ÕâÁ½¸öÖÖÇé¿ö£¬Assigned£¨Ö¸Õë±äÁ¿£©¶¼²»Îªnil , º¯Êý·Å»ØTrue£»
¶ø²ÎÊýΪnilʱÔò´«»ØFalse¡£
Assigned ²¢²»ÊÇÒ»¸öÕæÕýµÄº¯Êý¡£
¼¼ÇÉ£º
Óúô½Ð Assigned µÄ·½Ê½À´È¡´úÖ±½Ó°Ñ²ÎÊýÄÃÀ´ºÍnil±È½Ï£¬Ð§ÂÊ»á¸üºÃ¡£
 
2.Õâ¸öÎÊÌâÒª´ÓÄÚ´æ·½ÃæÀ´½âÊÍ
µ±Ä㽨¹¹Ò»¸öÎï¼þ SomeComponet.Create(Owner);
ϵͳ»áÓÐÒ»¸öÖ¸ÕëÖ¸ÏòÕâ¸ö¶ÔÏó
µ±Äã½â¹¹Ò»¸öÎï¼þ SomeComponet.Free;
ϵͳ»á½«Ö¸ÕëÖ¸µ½µÄ¶«Î÷ɱµô£¬µ«ÊÇÖ¸±ê»¹ÊÇÖ¸ÔÚÏàͬµÄλÖÃ
Çë×¢Òâ¼ÆËã»úµÄ×ÊÔ´ÊÇÓÐÏ޵ģ¬
ËùÒÔ¿ÉÄÜÏÂÒ»²½ÄãµÄ³ÌÐòÒª¸úϵͳҪ×ÊÔ´£¬
¸Õ²ÅµÄÖ¸ÕëλÖ㬾ͳöÏÖÁËÆäËüµÄÊý¾Ý
If Assigned(SomeComponet) then SomeComponet := nil;
Ïȼì²éÕâ¸ö¶ÔÏóÓÐûÓÐÔÚÆäËüµØ·½±»Éè³É nil£¬
È»ºóÔÙ½«ËüÉè³É nil ¡£
µ±ÎÒÃÇÎÞ·¨Ô¤²âʹÓÃÕß»áÈçºÎ²Ù±¬ËûµÄ¼ÆËã»ú£¬
³ÌÐòÔ±±ØÐëÁôÒâÄÚ´æµÄ¹ÜÀí¡£ СµÜdz¼û...
3
function Assigned(var P): Boolean;
Description
Use Assigned to determine whether the pointer or procedure referenced by P is nil. P must be a variable reference of a pointer or procedural type. Assigned(P) corresponds to the test P<> nil for a pointer variable, and @P <> nil for a procedural variable.
Assigned returns False if P is nil, True otherwise.
¼ì²éÖ¸ÕëÖ¸ÏòµÄ²Î¿¼±äÁ¿»ò¹ý³ÌÊÇ·ñΪnil
ÿ´ÎÎÒͨ³£µÄ´¦Àí·½·¨¶¼ÊÇ£º
if assigned(frm) then frm.close;   µ«Êǵ±Ï´ε÷ÓÃʱ¾Í»á³ö´í¡£ÎªÊ²Ã´ÄØ£¬Ö±µ½Õ¦ÌìÎÒ²ÅÖªµÀÔ­Òò
frm.close;frm.free; Ö»ÊÇÖ¸¶¨Õâ¿éÄÚ´æ¿ÉÒÔÖØÐ´£¬²¢Î´ÊÍ·ÅΪNIL Òò´Ëµ±Ï´ε÷ÓÃʱ¼´Ê¹frm.freeÒѾ­
Ö´Ðйýassigned(frm)ÈÔΪTRUE£¬ÔÙ´ÎÊÍ·Å frm.Close »òÕß frm.free ¿Ï¶¨»á±¨´í£»Ó¦Îªfrm.Close»òfrm.free ÊÇÊÍ·Å ¶ÔÏóÖ¸Õëfrm Ö¸ÏòµÄÄÚ´æ¿Õ¼ä£¬ÔÚÉÏ´ÎÒѾ­Êͷŵ÷ÁË£¬µ«ÊÇ frm ±¾Éí²¢Ã»ÓÐ ³õʼ»¯Îª nil ,Ïà·´Ëü»¹ÊÇÖ¸Ïò±»ÊͷŵÄÄÚ´æµØÖ·£»¶«Î÷ÒѾ­Ã»ÓÐÁË£¬Ã»Óеض«Î÷È¥ÊÍ·Å£¬²»±¨´í´í²Å¹Ö¡£
ÕýÈ·µÄ´¦Àí·½·¨£º
if assigned(frm) then
begin
   frm.close;
   frm:=nil;
end;
»ò:
if assigned(frm) then
begin
frm.close;
freeandnil(fr


Ïà¹ØÎĵµ£º

DelphiÖÐÁ÷µÄʹÓ㨱ȽÏÈ«Ãæ£©

Delphi ÖÐÁ÷µÄʹÓÃ(1) Óà TMemoryStream(ÄÚ´æÁ÷) ÈëÃÅ
ǰÑÔ:
Ëùν"Á÷", ¾ÍÊÇÒ»¶ÎÊý¾Ý»òÊÇÒ»¿éÄÚ´æ;
ÔÚ½øÐÐÁ÷²Ù×÷ʱ, ÎÒÃDz»±Ø¹ØÐÄÁ÷ÖеÄÊý¾Ýµ½µ×ÊÇʲô; Ö»ÐèÒªÖªµÀÁ÷µÄ´óСºÍµ±Ç°µÄÖ¸ÕëλÖÃ. ËùÒÔÁ÷Ö»ÓÐÁ½¸öÊôÐÔ:
Size¡¢Position.
¶ÔÁ÷µÄ²Ù×÷, ²»¹ý¾ÍÊǶÁÈ¡ºÍдÈë. ËùÒÔÁ÷×îÖ÷ÒªµÄ·½·¨¾ÍÊÇ Read ºÍ Write.
Ôںܶ࿠......

delphi ¶ÁÈ¡txtÎļþ


1¡¢ ·ÅÒ»ÏÂmemo¿Ø¼þ¡¢Ò»¸öbutton¡¢opendialog
ÔÚbuttonµÄclickʼþÖÐ
if opendialog1.Execute then
memo1.Lines.LoadfromFile(opendialog1.filename);  
2¡¢Àļòµ¥µÄʰ¡
var
   Mytxt : TStringList;
begin
   MyText :=
TStringList('ÄãµÄÎı¾Îļþ¼°Â·¾¶');
 
&nbs ......

Delphi±éÀúPanel×é¼þÉϵÄËùÓпؼþ

procedure frmMain.CLS; //Ö÷´°Ìå×Ô¶¨ÒåʼþCLS
var i:integer;
begin
  for i:=0 to panel5.ControlCount -1 do
  begin
    if panel5.Controls[i] is TEdit then  //Edit×é¼þ
    begin
       ((panel5.Contro ......

Delphi 쵀RTTI

Ŀ¼
===============================================================================
¡Ñ RTTI ¼ò½é
¡Ñ Àà(class) ºÍ VMT µÄ¹ØÏµ
¡Ñ Àà(class)¡¢ÀàµÄÀà(class of class)¡¢Àà±äÁ¿(class variable) µÄ¹ØÏµ
¡Ñ TObject.ClassType ºÍ TObject.ClassInfo
¡Ñ is ºÍ as ÔËËã·ûµÄÔ­Àí
¡Ñ TTypeInfo – RTTI ÐÅÏ¢µÄ½ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ