|
-
Oct 21st, 2007, 07:02 PM
#1
Thread Starter
New Member
Viewing Pictures and Changing Resolution
Hello and Good Day To all!
I am working on a project that displays photos in VB6.
I am using a form (used to display picture(s)) and a frame on top of the form which is used for controls.
The program is working fine however I am trying to add three option buttons that will change the resoultion at which the pictures are displayed. Not the computer display resolution just the picture size being displayed.
Below are some examples of my code.
I can run the program and manually change to each loadpic routine depending
on the loadpic routine I use (loadpic, loadpic2 or loadpic3), however, I'm having trouble with getting the
mthd?_Click codeing to do this dynamically.
-----THIS DOESN'T WORK--------------------------------
Private Sub mthd_Click(Index As Integer)
'MsgBox "Resoluton for this application is presently set to 1024 x 768 ", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "This is not Working Yet!"
'mthod = Index
'Pic1.Width = 640
'Pic1.Height = 480
If mthd_Click then
loadpic ' 1024 x 768
Else IF
mthd2_CLick2 Then
loadpic2 '800 x 600
Else If
mthd3_Click Then
loadpic3 '640 x 480
End Sub
-------------------------------------------------------
There are three option buttons (controls) which:
If the user selects one of the three different option buttons available (called mthd?_Click) then mthd_Click, mthd2_CLick & mthd3_CLick need to change to the correct function procedure loadpic, loadpic2 or loadpic3 and allpic, allpic2 or allpic3 respectively.
How can I accomplish this?
I believe:
1) allpic needs to be a variabel because there are three functions (allpic, allpic2 and allpic3)
2) loadpic needs to be a variable because there are three functions (loadpic, loadpi2 and loadpic3)
3) I might have to use a Select Case with some If Then statements?
Now:
1) mthd_CLick, mthd2_CLick & mthd3_CLick are the option buttons which when choosen by the user, contain the code which will change to the proper variables allpic? and loadpic? to call the correct procedure functions
2) there are 36 private functions which are called upon to make transition effects.
In these functions there are calls to allpic and photomtd functions. These need to point to the correct functions.
The code in these functions need to change depending on the mthd?_CLick option that is chosen by the user.
ex. mthd1_CLick would be allpic, mthd2_CLick would be allpic2 and mthd3_CLick would be allpic3.
ex. Private Function yroll() <----this is an example of just one of 36 transition functions that will need changing
Timer2.Enabled = False
fitpic
w = Pic1.ScaleWidth
h = Pic1.ScaleHeight
Me.PaintPicture Pic1, _
xx, yy, w, 15, _
0, 0, w, 15
For m = 0 To h - 1
If bol = True Then
On Error Resume Next
For n = 1 To 15
If bol = True Then
Me.PaintPicture Pic1, _
xx, yy + m + n, w, 1, _
0, 15 + m - n, w, 1
Else
Exit Function
End If
Next n
dely 1000
Me.PaintPicture Pic1, _
xx, yy + m, w, 1, _
0, m, w, 1
DoEvents
Else
Exit Function
End If
Next m
allpic Pic1 <------calls made here--- allpic needs to change depending on mthd chosen by user
photomtd <------calls made here
End Function
Private Function photomtd()
If fristtimer = False Then
Me.BackColor = colr
Timer2.Interval = 1
fristtimer = True
Else
Timer2.Interval = 1000
End If
Select Case mthod
'>>>>>>>>>
Case 0
inx = inx + 1
If inx <= photolist.ListCount - 1 Then
getaction
loadpic inx <-----------------------loadpic needs to change according to mthd choosen by user
Timer2.Enabled = True
End If
If inx = photolist.ListCount Then
'loop or not
If loops.Value = 1 Then
inx = 0
getaction
loadpic inx <-----------------------loadpic needs to change according to mthd choosen by user
Timer2.Enabled = True
Else
Timer2.Enabled = False
End If
End If
'<<<<<<<<<<<
Case 1
inx = inx - 1
If inx >= 0 Then
getaction
loadpic inx <-----------------------loadpic needs to change according to mthd choosen by user
Timer2.Enabled = True
End If
If inx = -1 Then
'loop or not
If loops.Value = 1 Then
getaction
loadpic inx <-----------------------loadpic needs to change according to mthd choosen by user
Timer2.Enabled = True
Else
Timer2.Enabled = False
End If
End If
'random
Case 2
If photolist.ListCount > 0 Then
inx = Int(Rnd * photolist.ListCount)
getaction
loadpic inx <-----------------------loadpic needs to change according to mthd choosen by user
Timer2.Enabled = True
Else
''''loop or not
If loops.Value = 1 Then
For m = 0 To templist.ListCount - 1
templist.ListIndex = m
photolist.AddItem templist.Text
Next
inx = Int(Rnd * photolist.ListCount)
getaction
loadpic inx <-----------------------loadpic needs to change according to mthd choosen by user
Timer2.Enabled = True
Else
Timer2.Enabled = False
End If
End If
End Select
Label4 = Pic1.ScaleWidth & "," & Pic1.ScaleHeight
End Function
My project has three functions like below except they are named loadpic loadpic2 loadpic3
'changes resolution to 1024 x 768
Private Function loadpic(indx As Integer) 'used with effects
If photolist.ListCount > 0 Then
indx = inx
photolist.ListIndex = indx
path1 = photolist.Text
On Error Resume Next
tempic.Picture = Pic1.Picture
tempic.Left = xx
tempic.Top = yy
Pic1.Picture = LoadPicture(path1)
scrpic.Picture = Pic1.Picture
a1 = Pic1.ScaleWidth: b1 = Pic1.ScaleHeight
Pic1.Width = 1024: Pic1.Height = 768
Pic1.AutoRedraw = True
Pic1.PaintPicture Pic1.Picture, _
0, 0, 1024, 768, 0, 0, a1, b1
Pic1.Picture = Pic1.Image
If Pic1.ScaleHeight Mod 7 = 0 Then
k = 6
Else
k = 7
End If
If mthod = 2 Then photolist.RemoveItem indx
xx = (Me.ScaleWidth - Pic1.Width) \ 2
yy = (Me.ScaleHeight - Pic1.Height) \ 2
If colorop(0).Value = True Then
colr = lblcolor.BackColor
For m = 0 To 1
yyx(m).BackColor = colr
xxy(m).BackColor = colr
Next
End If
If colorop(1).Value = True Then
Randomize
c1 = Int(256 * Rnd)
c2 = Int(256 * Rnd)
c2 = Int(256 * Rnd)
colr = RGB(c1, c2, c3)
For m = 0 To 1
yyx(m).BackColor = colr
xxy(m).BackColor = colr
Next
End If
If slide = 7 Then
If Pic1.ScaleWidth \ 80 = 0 Then
xy = 1
Else
xy = 80
End If
If Pic1.ScaleWidth \ 60 = 0 Then
yx = 1
Else
yx = 60
End If
cutting xy, yx
End If
End If
End Function
My project also has three functions like below except they are named allpic allpic2 allpic3
Private Function allpic(pics As Control)
Me.PaintPicture pics.Picture, xx, yy, 1024, 768, _
0, 0, pics.ScaleWidth, pics.ScaleHeight
End Function
Private Function allpic2(pics As Control)
Me.PaintPicture pics.Picture, xx, yy, 800, 600, _
0, 0, pics.ScaleWidth, pics.ScaleHeight
End Function
Private Function allpi3(pics As Control)
Me.PaintPicture pics.Picture, xx, yy, 640, 480, _
0, 0, pics.ScaleWidth, pics.ScaleHeight
End Function
Any help with this will be greatly appeciated and Thank You in Advance for your support!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|