我发现这段代码在最后一行中缺少函数调用,有关save to file命令的任何想法吗?我只是将它插入其中。
'CODE to SAVE InkPicture to FILE
Dim objInk As MSINKAUTLib.InkPicture
Dim bytArr() As Byte
Dim File1 As String
File1 = "C:\" & TrainerSig & ".gif"
Set objInk = Me.InkPicture2.Object
If objInk.Ink.Strokes.Count > 0 Then
bytArr = objInk.Ink.Save(2)
fSaveFile bytArr, File1
End If
答案 0 :(得分:0)
以下是将Access 2007中的VBA代码保存.InkPicture
到.isf
文件的kludgy版本。
Private Sub Command283_Click()
'CODE to SAVE InkPicture to FILE
Dim objInk As MSINKAUTLib.InkPicture
Dim bytArr() As Byte
Dim File1 As String
File1 = "C:\test.isf"
Set objInk = Me.InkPicture2.Object
If objInk.Ink.Strokes.Count > 0 Then
bytArr = objInk.Ink.Save(2)
Open File1 For Binary As #1
Put #1, , bytArr
Close #1
End If
End Sub
答案 1 :(得分:0)
我尝试了zaphod23的解决方案,它对我不起作用。我也觉得很奇怪,解决方案会以.isf格式保存,通常人们希望将inkPicture内容保存到图像文件(jpg,gif等)。我花了一段时间来搜索这些代码的各个部分,然后把它放在一起,所以我会在这里发布它给其他可能觉得有用的人。
这将在Microsoft Access表单中使用用于签名面板的inkPicture对象,将内容保存为gif图像,然后将图像放在表单上的图像对象中(这很有用,因为inkPicture内容不会显示当你打印表格时。)
On Error Resume Next
Dim imgBytes() As Byte
Dim sFilePathAndName As String
imgBytes = Me.signaturePanel.Ink.Save(IPF_GIF)
If (UBound(imgBytes) = 0) Then
MsgBox ("Please enter your signature")
Else
sFilePathAndName = (Application.CurrentProject.Path & "\images\system\signatures\" & "signature")
Open sFilePathAndName For Binary Access Write As #1
Put #1, 1, imgBytes
Close #1
Me.imgSignature.Picture = sFilePathAndName
End If