1000多行
所有表事件
BeforeSelChange事件
If e.OldRange.RowSel <> e.NewRange.RowSel '如果选择的是不同的行
If e.OldRange.RowSel >= 0 AndAlso e.OldRange.Rowsel < e.Table.Rows.Count Then '而且原来选择的是一个有效的数据行
Dim r As Row = e.Table.Rows(e.OldRange.Rowsel) '获得原来选择的行
r.Save() '保存之
End If
End If
If e.Col.name = "照片名称" And e.Row.Isnull("照片名称") = False Then
If Left(e.Row("照片名称"), e.Row("照片名称").LastIndexOf(".")) <> e.Row("档案号") Then
e.style = "红"
End If
ElseIf e.Col.name = "档案号" Then
If e.Row.Isnull("档案号") Then
e.style = "红"
End If
ElseIf e.Col.name = "题名" Then
If e.Row.Isnull("题名") Then
e.style = "红"
End If
End If
If e.DataCol.name = "照片名称" Then
If e.DataRow.Isnull("照片名称") Then
e.DataRow("路径") = Nothing
e.DataRow("照片宽") = Nothing
e.DataRow("照片高") = Nothing
e.DataRow("长高比例") = Nothing
e.DataRow("高长比例") = Nothing
e.DataRow("报表照片宽") = Nothing
e.DataRow("报表照片高") = Nothing
e.DataRow("版式") = Nothing
Else
If Forms("照片目录").Controls("TextBoxFile").text > "" Then
Dim img As Image = GetImage(Forms("照片目录").Controls("TextBoxFile").text & "\" & e.DataRow("照片名称")) '以下没有放在路径为空是因为通过重置列可以更改路径
If img IsNot Nothing Then
If e.DataRow.Isnull("路径") Then
e.DataRow("路径") = Forms("照片目录").Controls("TextBoxFile").text & "\" & e.DataRow("照片名称")
End If
If e.DataRow.Isnull("照片宽") Then
e.DataRow("照片宽") = img.Width
End If
If e.DataRow.Isnull("照片高") Then
e.DataRow("照片高") = img.Height
End If
If e.DataRow.Isnull("长高比例") Then
e.DataRow("长高比例") = e.DataRow("照片宽")/e.DataRow("照片高")
End If
If e.DataRow.Isnull("高长比例") Then
e.DataRow("高长比例") = e.DataRow("照片高")/e.DataRow("照片宽")
End If
If e.DataRow.Isnull("报表照片宽") Then
e.DataRow("报表照片宽") = 100 * e.DataRow("照片宽")/e.DataRow("照片高")
End If
If e.DataRow.Isnull("报表照片高") Then
e.DataRow("报表照片高") = 100
End If
If e.DataRow("长高比例") < 1 Then
e.DataRow("版式") = "竖"
ElseIf e.DataRow("长高比例") >= 1 Then
e.DataRow("版式") = "横"
End If
End If
End If
End If
End If