How to add scrollbars to a TComponent?
I am using a 3rd party control which is descended from TComponent and I want it to have scrollbars, preferably autoscrollbars.
Can I get them from TComponent?
开发者_Python百科Failing that, can I place a TPanel on my mainform & the component on that and get scrollbars? I intend to have the component (and Panel, or whatever) be alClient so that they autoresize when my component resizes, but I woudl also like them to have (auto) scrollbars.
If I understood what you're intended to do, do this:
- add a TScrollBox on the form
- add visual components on the TScrollBox component
- don't worry about scroll bars, because they will be shown automatically when needed(when a component is out of the visible area)
- have fun!
For visual controls you usually descend from TControl or (better) TWinControl. TWinControl is a wrapper around Windows controls (widgets), and Windows can provide scrollbars for contents. You might want to look at TScrollbox source code as a guide or a replacement for your TPanel idea.
精彩评论