我在 Access 表单上有大约 50 个图标图像 (.ico),但是我没有将它们存储在磁盘上。我想将它们从 Access 导出到磁盘位置。
我在此线程上尝试了建议的解决方案:
我无法打开生成的文件,可能是因为我的图像是 (.ico) 而不是 (.png)
编辑:我可以将图标复制到油漆中,将它们另存为 png,然后使用在线转换器将它们转换为图标。相当耗时,但它有效。
您可以使用此代码打击。
它会将提供的表单的所有图像控件的内容保存到同一文件夹中的文件中。
请注意,某些图像控件包含“奇怪”的二进制格式,可能无法通过每个工具正确显示。
此外,您还必须在自己导出后注意分配正确的文件扩展名。
将代码放在一个新模块中,然后在设计视图中打开表单并像这样调用它: SaveAllImageControls Forms("MyForm")
Public Sub SaveAllImageControls(ByRef sourceForm As Form)
Dim item As control
For Each item In sourceForm.Controls: Do
If item.ControlType <> acImage Then Exit Do
If IsNull(item.PictureData) Then Exit Do
Dim bArray() As Byte
bArray = item.PictureData
Dim filename As String
filename = Application.CurrentDb.Name & "-" & sourceForm.Name & "-" & item.Name & ".binary"
Dim fileNumber As Integer
fileNumber = FreeFile
Open filename For Binary As fileNumber
Put fileNumber, , bArray
Close fileNumber
Loop While False: Next item
End Sub
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句