线程释放不了了
做的一个画板,在listbox里面点选一个已画好的图形,就用红色方框框住它显示1s,然后复原。
当我快速连点好几个的时候,每次只有第一个能够复原,其他的都是被红色方框框住后就不变了,求解。。。
线程里的代码
procedure TPrompt.Execute;var x1, y1, x2, y2, tmpIndex: Integer;begin with MainFrm do begin Canvas.Pen.Color := clRed; Canvas.Brush.Style := bsClear; tmpIndex := lst1.ItemIndex; with TShape(ShapeList.Items[tmpIndex]) do begin BringToFront; x1 := Trunc(Left - 5); y1 := Trunc(Top - 5); x2 := Trunc(x1 + Width + 10); y2 := Trunc(y1 + Height + 10); Canvas.Rectangle(x1, y1, x2, y2); end; Sleep(1000); Canvas.Pen.Color := clBtnFace; Canvas.Rectangle(x1, y1, x2, y2); end;end;
procedure TMainFrm.lst1Click(Sender: TObject);var prompt: TPrompt;begin prompt := TPrompt.Create(False);end;