R
Rik
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TMainForm.Timer1Timer(Sender: TObject);
var
i: Integer;
DC: HDC;
begin
GetCursorPos(JCursor);
begin
iWidth := 110;
iHeight := 110;
DirectRect := Rect(0, 0, iWidth, iHeight);
SourCerect := Rect(JCursor.X - 5, JCursor.Y - 5, JCursor.X + 6, JCursor.Y + 6);
DC:=GetDesktopWindow;
C := TCanvas.Create;
C.Handle := GetDc(DC);
try
MainImage.Canvas.CopyRect(DirectRect, C, SourCerect);
finally
ReleaseDC(C.Handle, DC);
C.Free;
end;
Application.ProcessMessages;
end;
end;
这段代码为什么会在运行一段时间后出现Canvas does not allow drawing...我也查了查,网上有说用Canvas.Lock or Canvas.TryLock解决,可我使用却没有效果。请各位帮我看看
var
i: Integer;
DC: HDC;
begin
GetCursorPos(JCursor);
begin
iWidth := 110;
iHeight := 110;
DirectRect := Rect(0, 0, iWidth, iHeight);
SourCerect := Rect(JCursor.X - 5, JCursor.Y - 5, JCursor.X + 6, JCursor.Y + 6);
DC:=GetDesktopWindow;
C := TCanvas.Create;
C.Handle := GetDc(DC);
try
MainImage.Canvas.CopyRect(DirectRect, C, SourCerect);
finally
ReleaseDC(C.Handle, DC);
C.Free;
end;
Application.ProcessMessages;
end;
end;
这段代码为什么会在运行一段时间后出现Canvas does not allow drawing...我也查了查,网上有说用Canvas.Lock or Canvas.TryLock解决,可我使用却没有效果。请各位帮我看看