开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜