请问怎样实现做好的窗口能自动适应不同尺寸的显示器?
老大给的代码,试试?
例如用1024*768的分辨率设计了一个独立或模式窗口,希望在不同分辨率下,能自动缩放窗口,可以设置窗口的AfterLoad事件:
Dim w As Integer = sysinfo.ScreenWidth
Dim h As Integer = Sysinfo.ScreenHeight
With e.Form.BaseForm
.Width = .Width / 1024 * w
.Height = .Height /768 * h
End With
自己随便建个独立窗口,设3个按钮测试下就知道了:
1024*768
Dim w As Integer = sysinfo.ScreenWidth
Dim h As Integer = Sysinfo.ScreenHeight
With e.Form.BaseForm
.Width = .Width / 1024 * w
.Height = .Height /768 * h
End With
800*600
Dim w As Integer = 800
Dim h As Integer = 600
With e.Form.BaseForm
.Width = .Width / 1024 * w
.Height = .Height /768 * h
End With
1152*864
Dim w As Integer = 1152
Dim h As Integer = 864
With e.Form.BaseForm
.Width = .Width / 1024 * w
.Height = .Height /768 * h
End With
如果窗口变化了,但是窗口中的控制大小及位置没有变,感觉更难看了。
请教,窗口中的所有控件也根据进行调整才对?这个又如何实现呢?
[此贴子已经被作者于2011-5-31 11:39:03编辑过]
以下是引用baoxyang在2011-5-31 11:25:00的发言:
如果窗口变化了,但是窗口中的控制大小及位置没有变,感觉更难看了。
请教,窗口中的所有控件也根据进行调整才对?这个又如何实现呢?
[此贴子已经被作者于2011-5-31 11:39:03编辑过]
锚定和停靠:
http://help.foxtable.com/topics/0701.htm