Autor Beitrag
Zlatan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Do 27.01.11 18:46 
Ein Shape soll bei Berührung mit einem andereren Shape verschwinden.
Wie geht das??
Bitte antworten :wink:
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Do 27.01.11 18:53 
Du prüfst, ob du Shape1 und Shape2 übereinanderliegen (mit Width und Left und Top und Height) und rufst dann Shape.Hide(); auf.
Zlatan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Do 27.01.11 19:02 
wie prüfe ich das?
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Do 27.01.11 19:13 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var
  r:TRect;
begin
  if IntersectRect(r,Shape1.BoundsRect,Shape2.BoundsRect) then Shape2.Hide;

end;

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
Zlatan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Do 27.01.11 19:37 
von was ist das die Procedur?
von FormCreate?
das funktioniert nicht


Zuletzt bearbeitet von Zlatan am Do 27.01.11 20:06, insgesamt 1-mal bearbeitet
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Do 27.01.11 19:42 
Dein Ton macht richtig Spass ....
Wenn Du im Create prüfen willst ......

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
Zlatan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Do 27.01.11 19:58 
Was meinst du damit?
Beantworte doch bitte meine Frage
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Do 27.01.11 20:08 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
Procedure PruefeUndVersteckeWennNoetig(Shape1,Shape2:TShape);
var
  r:TRect;
begin
  if IntersectRect(r,Shape1.BoundsRect,Shape2.BoundsRect) then Shape2.Hide;

end;


Wo und wann Du das ganze aufruft bleibt Dir überlassen

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
Zlatan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Do 27.01.11 20:13 
geht irgendwie nicht
Das eine shape geht einfach unter das andere aber es verschwindet nicht
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 27.01.11 21:41 
Vielleicht hast du Shapes vertauscht und solltest eher shape1.hide; hinschreiben?

Vielleicht wären auch die zwei sachen ratsam für dich:
Christians Crashkurs
Delphi-Wikibook

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.