Delphi¶àÏß³Ìѧϰ£¨11£©£º¶àÏß³ÌͼÐβÙ×÷
VCL¶ÔÏó²»ÊÇḬ̈߳²È«µÄ£¬¶øÇÒËüÃǵÄÊôÐԺͷ½·¨±ØÐëÒª´ÓVCLÖ÷Ïß³ÌÖнøÐзÃÎÊ»ò±»Ö´ÐУ¬µ«ÓÐÁ½ÖÖVCL¶ÔÏóÊÇÀýÍâµÄÇé¿ö£¬ËüÃÇÊÇḬ̈߳²È«µÄ¡£Ò»ÖÖÊÇÈκÎͼÐζÔÏó£¬ÁíÒ»ÖÖÊÇTThreadList¡£
ÕâÒâζ×Ų»±Ø·ÇµÃÔÚÖ÷VCLÏß³ÌÖвÅÄÜÉèÖÃÒ»¸ö»²¼µÄ»±ÊÑÕÉ«£¬»ò»Ë¢ÀàÐÍ£¬¿ÉÒÔÔÚÁíÒ»¸öÏ̵߳Ļ·¾³ÖÐÍê³ÉÒ»µã¡£¶ÔÓÚͼÐζÔÏó£¬Ê¹ÓÃLockºÍUnLock£¬¶ø¶ÔÓÚThreadList£¬ÔòʹÓÃLockListºÍUnLockList£¬ÕâЩ·½·¨µÄÐÐΪÀàËÆÓÚÁÙ½çÇø£¬ÔÚµ÷ÓÃËüÃǵÄʱºò»á×èÖ¹ÆäËûÏ̵߳ÄÖ´ÐС£ÒòΪLock»áÖжÏËùÓÐÏ̵߳ÄÖ´ÐУ¬ËùÒÔÈç¹ûʹÓò»ÕýÈ·µÄ»°£¬Ó¦ÓóÌÐòÐÔÄÜ»áÓкܴóϽµ¡£±ÈÈ磺
Form1.Canvas.Lock;
For i := 0 to 10000 do
begin
Form1.Canvas.TextOut(20,20,str);
end;
Form1.Canvas.UnLock;ÉÏÃæÕâ¸ö´úÂëÖУ¬LockºóÔÙÑ»·£¬ÔòÑ»·½á¹¹¹ýÓÚÓµ¼·£¬Ëø¶¨Ê±¼ä¹ý³¤¡£ËùÒÔÓ¦¸Ã½«LockÓëUnLock·ÅÔÚÑ»·ÀïÃæ¡£
ÏÂÃæµÄÀý×Ó£¬Í¨¹ý¶àÏ̶߳Դ°Ì廲¼½øÐлÏß¡£µã“¿ªÊ¼”²Ëµ¥´´½¨N¸öÏß³ÌͬʱÍù´°Ìå»Ïߣ¬µã“½áÊø”ͬʱÖÕÖ¹N¸öÏ̡߳£
{Ö÷´°Ìå´úÂë}
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, Menus;
type
TForm2 = class(TForm)
MainMenu1: TMainMenu;
S1: TMenuItem;
T1: TMenuItem;
procedure S1Click(Sender: TObject);
procedure T1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
List:TList;
implementation
uses DrawThread;
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
begin
List:=TList.Create;
end;
procedure TForm2.FormDestroy(Sender: TObject);
begin
List.Free;
end;
//“¿ªÊ¼”²Ëµ¥
procedure TForm2.S1Click(Sender: TObject);
var
value:string;
i: Integer;
begin
value:=InputBox('Ìáʾ','ÇëÊäÈëÐèÒª´´½¨¶àÉÙỊ̈߳º','3');
try
for i := 0 to StrToInt(value) - 1 do
List.Add(TDrawThread.create(self));
except
on e:Exception do
Ïà¹ØÎĵµ£º
¼¼Êõ½»Á÷,DH½²½â.
Ã÷ÌìÈ¥×ø»ð³µ,»Ø¼Ò,½ñÌì¾ÍûÓÐÊÂ×ö,±¾À´ÔÚŪһ¸ö¿ç½ø³Ì»ñÈ¡ÆäËû³ÌÐòÀïÃæ×é¼þ,ÈçListView,ListBox,ButtonµÈµÄÐÅÏ¢,ͻȻÓиöÏë·¨×Ô¼ºÐ´¸öTimer,²»ÓÃSetTimerº¯Êý,ÎÒÃÇ×Ô¼ºÓøö¶àÏß³ÌÒ²ÕýºÃʵÏÖÕâ¸ö.·´Õýǰ¶Îʱ¼ä¶àÏß³ÌҲŪµÃ±È½Ï¶à,±¾À´Ïëµ¥¶À½²½²µÄ,ÏÖÔÚ¾ÍÓøöÀý×ÓÀ´ËµÃ÷°É.
д³ÉÒ»¸ö¿Ø¼þ:utTimer.pas
v ......
ÐèÒªÓõ½µÄÒ»¸öº¯Êý£º
LONG SetWindowLong(
HWND hWnd,
int nIndex,
LONG dwNewLong
);
ÆäÖÐnIndex GWL_EXSTYLE Retrieves the extended window styles.
dwNewLong WS_EX_TOOLWINDOW Creates a tool window; that is, a window intended to ......
¹ØÓÚdelphi Assigned
1.¸ù¾Ý Delphi Ö¸Áî²Î¿¼ÊÖ²áÖÐ
˵Ã÷£º
Assigned º¯Ê½ÔÚ²ÎÊý²»Îªnilʱ´«»ØTrue,±íʾָÕëÒѾָµ½Ä³¸öÄÚ´æµØÖ·£¬Õâ¸öÄÚ´æµØÖ·¿ÉÄÜÊÇÒ»¸ö¶ÔÏóµØÊ×µØÖ·£¬Ò²¿ÉÄÜÔÚº¯Êý»ò¹ý³ÌÖУ¬ÉùÃ÷Ò»¸öÖ¸Õë±äÁ¿£¬Ã»Óи³ÖµÎªnil £¬ÎÞÂÒµÄÖ¸Ïòij´¦£¬ÕâÁ½¸öÖÖÇé¿ö£¬Assigned£¨Ö¸Õë±äÁ¿£©¶¼²»Îªnil , º¯Êý·Å»ØTrue£»
¶ø² ......
http://www.91v1.cn/bbs/read.php?tid-1797.html
ÎÒÃÇÌṩµÄÊÇÈ«Ì×,ĿǰËûÃÇ·¢µÄ.ÉçÇøÒÑÂ¼ÖÆÍê±Ï.Ò»¸ùë²»ÉÙ.
-------------------------------------------------------------------------------------------------------------------------
¸Ã½Ì³ÌÓÉ91v1ÉçÇøÃâ·ÑÌṩ.¾ßÌåÃâ·ÑÁìÂëÏêÇé¹Û¿´ÖÖ×Ó°ü,
--------------- ......
ÔÚʹÓöàÏ̵߳Äʱºò£¬Èç¹û¶àÏ̶߳Ôij¸öÌØ¶¨µÄ¹«¹²Êý¾Ý»ò×ÊÔ´½øÐзÃÎÊ£¬ÐèÒª¶Ô¶àÏ߳̽øÐÐе÷²Ù×÷£¬½Ð×öÏß³Ìͬ²½¡£
ÀýÈ磺Èý¸öÏ̷ֱ߳ðÑ»·µØÏòListBoxÖÐдÈëÊý¾Ý¡£Ã»ÓнøÐÐͬ²½Ê±£¬Ð´ÈëµÄ˳ÐòÊDz»È·¶¨µÄ¡£
{Ö÷´°Ìå´úÂë}
unit Unit2;
interface
uses
Windows, Messages, SysUtils, V ......