Autor Beitrag
Sprotti
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Fr 07.10.05 10:17 
hallo,
ich möchte aus einem Panel ein paintTo auf ein Canvas ausführen.
in der delphi Hilfe steht, dass man eine Zeichenfläche auf die man zeichnen möchte vorher sperren muss.
Wie denn sperren :? ?
Gruß Sprotti
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Fr 07.10.05 10:26 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
Canvas.Lock;
Canvas.Lineto(....
....
Canvas.Unlock;


Optimal ist hier natürlich noch ein with um das etwas anzuhübschen :D

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
with Canvas do
begin
  Lock;
  Lineto(...
  ...
  Unlock;
end;
mg80s
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 33

WinXP SP2
Delphi 6 Personal ;) , C# (VS 2003 Prof.)
BeitragVerfasst: Fr 07.10.05 10:36 
Mal so Interessehalber: Warum sollte das(/der/die?) Canvas denn gesperrt werden? Damit kein anderes "Element" seine Spuren drauf hinterlassen kann :?
Ich habe es bis jetzt noch nie gemacht und auch nie (sichtbare) Probleme bekommen, lasse mich aber gern belehren :wink:
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Fr 07.10.05 12:12 
Ich auch nicht aber wer fragt kriegt auch ne Antwort ;-)
Laut Hilfe ist das für multithreading notwendig, was auch logisch ist.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 07.10.05 12:34 
Na ja, also ich hab das auch bei Multithreading nie gemacht, denn da die VCL nicht threadsicher ist, muss man ja sowieso den Quelltext dementprechend schreiben und simultane Zugriffe ausschließen.

Heißt: Bei mir ist durch kritische Sektionen oder ähnliche Techniken ein simultaner Zugriff sowieso stets ausgeschlossen.