Hi guys,

I´m using VB6 and its Active Report

My problems are:

1) I have several dir with some pictures and I would like to use like
image1.picture= = LoadPicture(c:\dir1\pict1.jg)
image2.picture= = LoadPicture(c:\dir1\pict2.jg)
image3.picture= = LoadPicture(c:\dir2\pict1.jg) and so on..

One page with 2 coluns / 3 rows with image.picture,

But the pictures can change theirs Width and Height, example: images photo 338x224, and image digitalized text 598x50.

So, if the image size > image1.picture default (338x224), I need to use the image(n).picture in a single row with its size and disable the second one in a row.
if the image size = image(n).picture default (338x224), I need to use the both in a row.


2) How to get picture´s Witdh and Height in a code before include it in a image(n).picture .Witdh .Height??

Bellow is my code I made so far....
I´ll be glad for your help, couse I´m new as VB programmer .
Sorry about the english too. :(

Thanks a lot guys.
Ivan

Dim intLoop As Integer
Dim objControl As Image
'
mstrDirEntrada = "C:\Inetpub\wwwroot\DN\uploads\raat.da\" & Field28.Text & "\"
strMask = mstrDirEntrada & "*.jpg"
hArq = True
hSearch = FindFirstFile(strMask, WFD)
contador = 1
Image1.Picture = Nothing
Image2.Picture = Nothing
Image3.Picture = Nothing
Image4.Picture = Nothing
Image5.Picture = Nothing
Image6.Picture = Nothing
'
If hSearch <> INVALID_HANDLE_VALUE Then
While hArq
strArquivo = StripNulls(WFD.cFileName)
If Dir(mstrDirEntrada & strArquivo, vbArchive) <> "" And strArquivo <> "." And strArquivo <> ".." Then
'
' *** does not work with Active eport
'Set objControl = Me.Controls("Image" & contador) 
'Set objControl.Picture = LoadPicture(dados)
' ***
If contador = 1 Then
With Image1
.Picture = LoadPicture(dados)
.Width = 3420
.Height = 2520
End With
End If
If contador = 2 Then
Image2.Picture = LoadPicture(dados)
End If
If contador = 3 Then
Image3.Picture = LoadPicture(dados)
End If
If contador = 4 Then
Image4.Picture = LoadPicture(dados)
End If
If contador = 5 Then
Image4.Picture = LoadPicture(dados)
End If
If contador = 6 Then
Image4.Picture = LoadPicture(dados)
End If

End If

contador = contador + 1
'Set objControl = Nothing
hArq = FindNextFile(hSearch, WFD)
Wend
hArq = FindClose(hSearch)
Else
MsgBox "No file found!"
End If
Exit Sub

ERRO:
MsgBox Err.Number & " - " & Err.Description

End Sub

Public Function StripNulls(OriginalStr As String) As String
'============================================================

If (InStr(OriginalStr, Chr(0)) > 0) Then
OriginalStr = Left(OriginalStr, InStr(OriginalStr, Chr(0)) - 1)
End If
StripNulls = OriginalStr
End Function

I'm not exactly sure what you're trying to do, but if you need the dimensions of a picture, why not load it in an autosiing picture box and read the dimensions?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.