滚动条并以嵌套形式与客户端对齐 [英] Scrollbars and align to client in a nested form

查看:73
本文介绍了滚动条并以嵌套形式与客户端对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序具有一个表单-用于设计其他表单,并包含一个对象检查器(请参见bas ascii艺术)

  ----------------------- 
| obj |设计表格|
| insp |在这里
| | |
-----------------------

因此,应用程序的主窗体包含对象窗体和可以放置组件的另一窗体(顶部还有一个工具栏可以选择组件,但我没有显示)。 / p>

现在,如果我将主窗体放大,我希望内容可以扩展以适合它...

  ------------------------------- 
| obj |设计表格|
| insp |在这里
| | |
| | |
| | |
-------------------------------

所以我的表单设计者表单具有 Align:= alClient;



但是,如果我在其上放置一个组件,以使其与边缘重叠...

 - ----------------------------- 
| obj |设计表格|
| insp |这里-----------
| | |组件|
| | -----------
| | |
-------------------------------

当然,屏幕会显示

  ------ ------------------------ 
| obj |设计表格|
| insp |这里----- |
| | | comp |
| | ----- |
| | |
-------------------------------

,我想要一个自动滚动条。



但是,似乎 Align := alClient; 覆盖AutoScroll:= true;



有什么办法解决此冲突吗?
1)设计器区域应缩小和增长,并始终填充主窗体的正确部分,因为调整了主窗体的大小
2)如果放置的组件悬于设计器窗体的边缘,则它应该会增加滚动条



我是否完全忘记了要点?我有处理组件放置的代码-我是否应该在此处检查是否需要添加滚动条?

解决方案

一个相对简单的解决方案是将窗体的 Align 切换为 alNone 并在父窗体的resize事件上调整其位置和大小。大概您在其中有一个拆分器,您还必须收听其大小事件。



只要您只有检查员和设计表单,那么这就是一个非常简单的解决方案。如果您在那里有更多的工具窗口,那么它将变得更加棘手,但基本思想可以扩展。


My app has a form - which is used to design other forms and contains an Object Inspector (bas ascii art follows)

-----------------------
|obj | design forms   | 
|insp| here           |
|    |                |
-----------------------

so, the app''s main form contains the object form and another form onto which components can be placed (there's also a toolbar at the top to select components, but I haven't shown that).

Now, If I make the main form larger, I would like the contents to expand to fit it ...

-------------------------------
|obj | design forms           | 
|insp| here                   |
|    |                        |
|    |                        |
|    |                        |
-------------------------------

so my "form designer" form has Align := alClient;

but, if I place a component on it, so that it overlaps the edge ...

-------------------------------
|obj | design forms           | 
|insp| here              -----------
|    |                   |component|
|    |                   -----------
|    |                        |
-------------------------------

the screen of course shows

-------------------------------
|obj | design forms           |
|insp| here              -----|
|    |                   |comp|
|    |                   -----|
|    |                        |
-------------------------------

and I would like an auto scroll bar.

But, it seems that Align := alClient; overrides AutoScroll := true;

Any idea how to resolve this conflict? 1) the designer area should shrink and grow, always filling the right part of the main form as the main form is resized 2) if a component is placed which would overhang the edge of the designer form then it should grow scroll bar(s)

OR am I totally missing the point? I have code that handles the placing of the component - should I be checking there if I need to add scrollbars?

解决方案

I think a relatively easy solution would be to switch the form's Align to alNone and position and size it on the parent form's resize event. Presumably you've got a splitter in there whose size events you would also have to listen to.

So long as you only have the inspector and the design form then that's a pretty simple solution to implement. If you have more tool windows in there then it would get more tricky but the basic idea can be extended.

这篇关于滚动条并以嵌套形式与客户端对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆