Windows DPI 表单缩放
我之前一直使用VGScene(Firemonkey 的前身)来创建应用程序,最近切换到 Delphi XE2 的 Firemonkey。
要在 VGScene 中缩放表单,我所要做的就是缩放 VGScene 对象的 Root 对象,以缩放表单中的所有内容。但是我不确定如何使用 FireMonkey 来完成此操作。
我的表单由两个 TLayout 组成,一个左对齐,一个设置为客户端对齐,在左侧布局和客户端布局之间有一个垂直分隔符控件。客户端布局上还有一个设置为客户端对齐的列表框。
我尝试过使用一个带有所有控件的基本 TLayout,并缩放基本 TLayout,但这并不能正常工作,左侧布局可以正常缩放,但客户端布局的列表框似乎延伸到了右侧和底部边缘客户端布局对象?即,当您有完整列表时,列表项会延伸到表单的右边缘(被切断),并且垂直滚动条也不会完全显示,因为它会延伸到表单的底部。就好像客户端布局的宽度和高度缩放到大于表单允许的大小,但它不应该仍然填充表单区域吗?
我尝试缩放单个对象,就像缩放列表框一样,但这会产生相同的结果,列表框超出了表单的边界。
有人有什么想法吗?
I have previously been using VGScene (Firemonkey predecessor) to create an application and have recently switched to Delphi XE2's Firemonkey.
To scale my form in VGScene all I had to do was to scale the Root object of the VGScene object to scale all content in the form. However I am unsure how this should be done using FireMonkey.
My form consists of two TLayouts, one left aligned and one set to Client align, with a vertical splitter control between the left and client layouts. The client layout also has a list box on it set to client alignment.
I have tried having a base TLayout with all my controls on it, and scaling the base TLayout but this doesn't quite work properly, the left layout scales properly, but the client layout's listbox seem to extend past the right and bottom edge of the client layout object? i.e. when you have a full list the list items extend past the right edge of the form, (which are cut off) and the vertical scrollbar isn't shown completely either as it extends past the bottom of the form. It is as though the client layout's width and height are scaled to that larger than the form allows, but should it not still fill the form's area?
I have tried to just scale the individual object's, like just scaling the listbox, but this produces the same result, the listbox extends past the bounds of the form.
Anyone have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种可能是您没有完全遵循布局控件和拆分器的说明,按照 TSplitter 文档的建议?
如果不这样做,很容易就会出现这样的情况:所有属性似乎都设置为正确的值,但不知何故控件和拆分器就是不配合。我建议再试一次,特别注意使
align
属性具有正确的值,即alLeft
在左侧组件上,alLeft
在左侧组件上splitter 和右侧组件上的alClient
。One possibility is that you didn't quite follow exactly the instructions for laying out your controls and splitter, as recommended on the TSplitter documentation?
If you didn't, it is easy to get to a point where all the properties seem to be set to the right values, but somehow the controls and splitter just don't cooperate. I would recommend trying again, paying careful attention to getting the
align
properties with the correct values, i.e.alLeft
on the left component,alLeft
on the splitter, andalClient
on the right component.