问题
I am trying to load a tframe inside a delphi package (bpl) to be shown in my main app please give me code for both package and application.
回答1:
Give a man a fish and he eats for a day, learn a man to fish and he eats his whole life. So no code for you :)
How you should do it:
- Start Delphi, Create a new package.
- Add a TFrame to your bpl
- Save and compile, you should now have a .bpl and a .dcp.
- Close all
- Create a new application
- In your project properties, turn on "Build with Runtime packages"
- Add your bpl to the runtime packages list.
- Include the directories of your bpl and dcp files in the search path
- Close your project properties
- Go to your Form1, add the unit with your TFrame to your uses.
- In the FormCreate event, create the TFrame and add it to your application
- Compile and run
Summary: Create a package (bpl) with your frames. In your application, add the bpl to your runtime packages list and then use the TFrames as you would normally do.
来源:https://stackoverflow.com/questions/3994629/load-tframe-from-bpl-to-application