24. april 2002 - 18:11Der er
9 kommentarer og 1 løsning
Billede i en klasse?
Hej alle! Jeg sidder og er ved at lave et lille spil og tænkte på om jeg egentlig kan oprette en klasse i en unit for sig selv og smide et billede i den så jeg så senere kan oprette en masse billeder på formen uden at have sat en masse TImage komponenter på først.
Kan man få programmet til selv at indsætte TImage? Hvordan?
Use the Parent property to get or set the parent of this control. The parent of a control is the windowed control that contains the control. If one control (parent) contains others, the contained controls are child controls of the parent. For example, if an application includes three radio buttons in a group box, the group box is the parent of the three radio buttons, and the radio buttons are the child controls of the group box.
When creating a new control at runtime, assign a Parent property value for the new control. Usually, this is a form, panel, group box, or some control that is designed to contain another. Changing the parent of a control moves the control onscreen so that it is displayed within the new parent. When the parent control moves, the child moves with the parent.
Some controls (such as ActiveX controls) are contained in non-VCL windows rather than in a parent control. For these controls, the value of Parent is nil and the ParentWindow property specifies the non-VCL parent window.
Note: Don't confuse the Parent property declared in TControl with the Owner property declared in TComponent. The Parent of a control is always a windowed control that visually contains the control, and which is responsible for writing the control to a stream when the form is saved. The Owner of a component is the component that was passed as a parameter in the constructor and that controls when the component is freed.
Synes godt om
Slettet bruger
24. april 2002 - 19:32#4
Det er den komponent som den tegner billedet på. Det er ikke altid det samme som 'owner' men ofte 'owner' sige hvilken komponent den tilhører. Hvis 'owneren' bliver destrueret så gør den komponent det ogse.
Sorry... Parent er selvfølgelig IKKE en komponent... Parent er en property, det må jeg hellere lige skrive før der kommer en eller anden Delphi-gut og skælder mig ud! :)
Jeg har fattet ideen! Ville sådan set bare lige sige tak! ;)
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.