COLOCAR UMA IMAGEM DO RESOURCE EM UM FORMULARIO

USUARIO.EXCLUIDOS 11/09/2007 23:22:37
#235139
tenho um arquivo themes.res

nele tem umas imagens de fundo usado no ribbon

gostaria de saber como eu faço pra colocar em formulário comum do meu projeto.


USUARIO.EXCLUIDOS 11/09/2007 23:32:32
#235140
Resposta escolhida
ta anexado como ler imagens de resources
USUARIO.EXCLUIDOS 12/09/2007 01:57:48
#235143
Eu cnsegui desse jeito, código tirado de um exemplo do ribbon, exemplo postado pelo ELucimar. só retirei o desnecessário.

No form que vai colocar a imagem
Me.Picture = LoadBackground()

Em um Móodulo

Private Declare Function GetTempFileName Lib "kernel32" Alias "GetTempFileNameA" (ByVal lpszPath As String, ByVal lpPrefixString As String, ByVal wUnique As Long, ByVal lpTempFileName As String) As Long
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Const MAX_PATH = 260

Private Property Get TempDir() As String
Dim sRet As String, c As Long
Dim lErr As Long
sRet = String$(MAX_PATH, 0)
c = GetTempPath(MAX_PATH, sRet)
lErr = Err.LastDllError
TempDir = Left$(sRet, c)
End Property
Private Property Get TempFileName(Optional ByVal sPrefix As String, Optional ByVal sPathName As String) As String
Dim lErr As Long
Dim iPos As Long
If sPrefix = "" Then sPrefix = ""
If sPathName = "" Then sPathName = TempDir
Dim sRet As String
sRet = String(MAX_PATH, 0)
GetTempFileName sPathName, sPrefix, 0, sRet
lErr = Err.LastDllError
iPos = InStr(sRet, vbNullChar)
If Not iPos = 0 Then
TempFileName = Left$(sRet, iPos - 1)
End If
End Property
Public Property Get LoadBackground() As IPicture
Dim sFile As String
Dim b() As Byte
Dim iFile As Integer
On Error GoTo ErrorHandler
Select Case m_Theme
Case 0
b = LoadResData(141, "BLACK")
Case 1
b = LoadResData(141, "BLUE")
Case 2
b = LoadResData(141, "SILVER")
End Select
sFile = TempFileName("LRP")
iFile = FreeFile
Open sFile For Binary Access Write Lock Read As #iFile
Put #iFile, , b
Close #iFile
iFile = 0
Set LoadBackground = LoadPicture(sFile)
KillFile sFile
Exit Property
ErrorHandler:
Dim lErr As Long, sErr As String
lErr = Err.Number: sErr = Err.Description
If Not iFile = 0 Then Close #iFile
KillFile sFile
Err.Raise Err.Number, App.EXEName & ".cLoadResPicture", Err.Description
Exit Property
End Property

Private Sub KillFile(ByVal sFile As String)
On Error Resume Next
Kill sFile
End Sub


Tópico encerrado , respostas não são mais permitidas