|
-
Jan 11th, 2007, 03:07 AM
#1
Thread Starter
Member
Urgent~~Vscrollbar
VB Code:
Private Sub VScroll1_Change()
VScroll1.Max = scrollMax
If VScroll1.Value = 0 Then
picPV.Top = 600 'PicScale.Top
Else
picPV.Top = ((VScroll1.Value) / 20) * -ScaleHeight
End If
End Sub
i want to set the vscrollbar in the picturebox.
however, it seems ot sth wrong in the code.
the whole picturebox move up when i pulled down the scrollbar..
is the setting correct?
-
Jan 11th, 2007, 03:36 AM
#2
Re: Urgent~~Vscrollbar
 Originally Posted by enzotam
VB Code:
Private Sub VScroll1_Change()
VScroll1.Max = scrollMax
If VScroll1.Value = 0 Then
picPV.Top = 600 'PicScale.Top
Else
picPV.Top = ((VScroll1.Value) / 20) * -ScaleHeight
End If
End Sub
i want to set the vscrollbar in the picturebox.
however, it seems ot sth wrong in the code.
the whole picturebox move up when i pulled down the scrollbar..
is the setting correct?
Check this KB article
"http://support.microsoft.com/kb/186429" --How To Create Scrollable Viewports
-
Jan 11th, 2007, 04:18 AM
#3
Thread Starter
Member
Re: Urgent~~Vscrollbar
but the image on the picture is plotted using the data not the picture
is it also useful for this situation?
-
Jan 11th, 2007, 05:27 AM
#4
-
Jan 11th, 2007, 08:46 PM
#5
Thread Starter
Member
Re: Urgent~~Vscrollbar
oh...
VB Code:
Set mPic = LoadPicture("D:\chory.jpg")
However, i m not load the picture from driver directly.
I get the data from database and then use the function to plot the picture.
then how to set it???
-
Jan 11th, 2007, 10:34 PM
#6
Re: Urgent~~Vscrollbar
VB Code:
Set mPic = Picture1.Image
-
Jan 11th, 2007, 11:30 PM
#7
Thread Starter
Member
Re: Urgent~~Vscrollbar
VB Code:
Private Sub Form_Load()
PicColor.Visible = False
RefreshButton.Enabled = False
'scrollMax = 51
'HScroll1.Max = scrollMax ' Set maximum value.
'HScroll1.LargeChange = 3 ' Cross in 17 clicks.
'HScroll1.SmallChange = 1 ' Cross in 51 clicks.
With Picture2
.ScaleMode = vbPixels
.AutoRedraw = True
Set mPic = picPV.Image 'LoadPicture("C:\mypic.bmp") '(Load your picture in this line)
mWidth = ScaleX(mPic.Width, vbHimetric, vbPixels)
mHeight = ScaleX(mPic.Height, vbHimetric, vbPixels)
.PaintPicture mPic, 0, 0
End With
If mHeight > Picture2.ScaleHeight Then
With VScroll1
.Min = 0
.Max = mHeight - Picture2.ScaleHeight
.SmallChange = ((mHeight - Picture2.ScaleHeight) / 100) + 1
.LargeChange = ((mHeight - Picture2.ScaleHeight) / 10) + 1
End With
Else
VScroll1.Enabled = False
End If
If mWidth > Picture2.ScaleWidth Then
With HScroll1
.Min = 0
.Max = mWidth - Picture2.ScaleWidth
.SmallChange = ((mWidth - Picture2.ScaleWidth) / 100) + 1
.LargeChange = ((mWidth - Picture2.ScaleWidth) / 10) + 1
End With
Else
HScroll1.Enabled = False
End If
End Sub
i already changed it.
but it seems not work~
it only show the image on picPV..and nth on picture2.
my picture2 is sited inside the picPV.
and HScroll and VScroll also sited outside both picturebox~
is anything step i set wrongly?
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
|