-- 作者:有点甜
-- 发布时间:2014/8/27 17:32:00
--
内部函数【事务_事务布局】改一下
Dim ftb As WinForm.Table = Args(0) \'要布局的表格控件
Dim gr = ftb.Table.Grid \'获取C1对象 Dim dc As new Dictionary(of String ,List(Of DataRow)) \'获取事务数据 Dim drs As List(Of DataRow) = DataTables("个人事务").Select("开始时间>=\'" & Vars("个人事务_起") & "\' and 结束时间<=\'" & Vars("个人事务_终") & "\'","开始时间") Dim str As String Dim drs1 As List(of DataRow) For Each dr As DataRow In drs str = Format( dr("开始时间"),"yyyy-MM-dd") If dc.ContainsKey(str) Then drs1 = dc(str) drs1.Add(dr) Else drs1 = new List(of DataRow) drs1.Add(dr) dc.Add(str,drs1) End If Next Dim r,c,y,m,d,i As Integer Dim Left,Top,Width,Height As Integer For Each str In dc.Keys Dim sp As TimeSpan = CDate(str) - Cdate(Vars("个人事务_起"))
r = (sp.TotalDays\\7)*2 + 3 \'取整数(行),跨行 c = (sp.TotalDays Mod 7) + 1 \'取列位置
Left = gr.Cols(c).Left Width = gr.Cols(c).Right - Left Top = gr.Rows(r).Top Height = gr.Rows(r).Height - 2 If Height/dc(str).count < 24 Then Height = Height/dc(str).count Else Height = 24 End If i = 0 For Each dr As DataRow In dc(str) \'Public Sub New(ByVal 标题 As String, ByVal 任务类型 As Integer, ByVal 内容 As List(Of String)) Dim a As new My_事务标签("kankan",2,new List(of String)) a.tDate = str a.Top = Top + Height * i + 2 a.Left = Left + 2 a.Width = Width - 4 a.Height = Height - 2 a.BringToFront a.Visible = True a.text = dr("主题") gr.Controls.Add(a) i+= 1 Next Next
|