Public Function GetImagesStr(VBP As VBProject) As String
'
';- Image Plugins
'UseJPEGImageDecoder()
Dim strCode As String
Dim code2 As String
Dim code1 As String
Dim st As String
strCode = "" & vbCrLf
code1 = code1 & ";- Image Plugins" & vbCrLf
code1 = code1 & "UseJPEGImageDecoder()" & vbCrLf
code1 = code1 & "UsePNGImageDecoder()" & vbCrLf & vbCrLf
strCode = strCode & ";- Images" & vbCrLf
strCode = strCode & "DataSection" & vbCrLf
code1 = code1 & vbCrLf & ";- Image Globals" & vbCrLf
code2 = ";- Catch Images" & vbCrLf
Dim vbctmp
Dim vbc As VBComponent
Dim vbf As VBForm
For Each vbctmp In VBP.VBComponents
Set vbc = vbctmp
Set vbf = vbc.Designer
Dim ctltmp
Dim ctl As VBControl
For Each ctltmp In vbf.VBControls
Set ctl = ctltmp
Dim strName As String
strName = ImagePath & "\Image_" & vbc.Name & "_" & ctl.Properties("Name").Value & ".bmp"
'Debug.Print ctl.ClassName
Dim stxx As String
stxx = "PictureBox;"
If InStrB(stxx, ctl.ClassName & ";") > 0 Then
Dim nx As Long st = "Image_" & vbc.Name & "_" & ctl.Properties("Name").Value '图片常量名称。
code1 = code1 & "Global " & st & vbCrLf '代码声明段。
code2 = code2 & st & "= CatchImage(" & nx & ", ?" & st & ")" & vbCrLf '代码创建图像内存段。
nx = nx + 1
'=======保存图片到文件。
Dim pic As Picture
Dim obj As Object
Set obj = ctl.Properties("Picture").Value
SavePicture obj, Me.pvbImageFolder + strName
'SaveBinFile bxx, Me.pvbImageFolder + strName
'编写包含到文件的代码。
strCode = strCode & "Image_" & vbc.Name & "_" & ctl.Properties("Name").Value & ":" & vbCrLf
strCode = strCode & " IncludeBinary """" & strName & """" & vbCrLf"
xx:
End If
Next ctltmp
Next vbctmp
strCode = code1 & vbCrLf & code2 & vbCrLf & strCode & "EndDataSection" & vbCrLf
GetImagesStr = strCode
End Function
';- Images
'DataSection
'Image0:
' IncludeBinary "D:\nuke\php-nuke-7.5\PHP-Nuke-7.5.0\html\images\code_bg.jpg"
'Image1:
' IncludeBinary "D:\nuke\php-nuke-7.5\PHP-Nuke-7.5.0\html\images\logo.png"
'EndDataSection
是保存不了的。 类型不一样 取得的属性里有个 VBE子属性 。
很烦躁 。
大家帮一下。 如果你知道 frx 文件的文件格式的话, 更好。
多谢各位了。