以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  我想让表随着界面大小自动调整该怎么设置  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=104577)

--  作者:初心不改再说未来
--  发布时间:2017/8/1 11:41:00
--  我想让表随着界面大小自动调整该怎么设置
我想让表随着界面大小自动调整该怎么设置?
我的客户电脑分辨率有大有小,我设定死大小可能会不太人性化

所以怎么设置才能让软件支持表随界面大小走?
不至于太大露出表边缘的黑框
[此贴子已经被作者于2017/8/1 11:59:55编辑过]

--  作者:有点甜
--  发布时间:2017/8/1 12:42:00
--  

AfterLoad、SizeChanged事件

 

Dim t As Table = e.Form.controls("Table1").Table
Dim width As Double = t.grid.width - t.grid.cols(0).widthdisplay
Dim sum As Double = 0
For Each c As object In t.grid.cols
    If c.index > 0 andalso c.visible = True Then
        sum += c.widthdisplay
    End If
Next
For Each c As object In t.grid.cols
    If c.index > 0 AndAlso c.visible = True Then
        c.width = c.widthdisplay/sum*width
    End If
Next


--  作者:初心不改再说未来
--  发布时间:2017/8/1 12:52:00
--  
Dim t As Table = e.Form.controls("Table1").Table

Table1?如果我有20张表的话,是怎么写这块?

--  作者:有点甜
--  发布时间:2017/8/1 12:59:00
--  

Dim ts() As String = {"table1", "table2"}
For Each s As String In ts
    Dim t As Table = e.Form.controls(s).Table
    Dim width As Double = t.grid.width - t.grid.cols(0).widthdisplay
    Dim sum As Double = 0
    For Each c As object In t.grid.cols
        If c.index > 0 AndAlso c.visible = True Then
            sum += c.widthdisplay
        End If
    Next
    For Each c As object In t.grid.cols
        If c.index > 0 AndAlso c.visible = True Then
            c.width = c.widthdisplay/sum*width
        End If
    Next
Next

 

不会做上传具体例子说明。