Results 1 to 7 of 7

Thread: Urgent~~Vscrollbar

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2006
    Posts
    44

    Urgent~~Vscrollbar

    VB Code:
    1. Private Sub VScroll1_Change()
    2.     VScroll1.Max = scrollMax
    3.     If VScroll1.Value = 0 Then
    4.         picPV.Top = 600 'PicScale.Top
    5.     Else
    6.         picPV.Top = ((VScroll1.Value) / 20) * -ScaleHeight
    7.     End If
    8. 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?

  2. #2
    Fanatic Member amrita's Avatar
    Join Date
    Jan 2007
    Location
    Orissa,India
    Posts
    888

    Smile Re: Urgent~~Vscrollbar

    Quote Originally Posted by enzotam
    VB Code:
    1. Private Sub VScroll1_Change()
    2.     VScroll1.Max = scrollMax
    3.     If VScroll1.Value = 0 Then
    4.         picPV.Top = 600 'PicScale.Top
    5.     Else
    6.         picPV.Top = ((VScroll1.Value) / 20) * -ScaleHeight
    7.     End If
    8. 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

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2006
    Posts
    44

    Re: Urgent~~Vscrollbar

    but the image on the picture is plotted using the data not the picture
    is it also useful for this situation?

  4. #4
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Urgent~~Vscrollbar


  5. #5

    Thread Starter
    Member
    Join Date
    Aug 2006
    Posts
    44

    Re: Urgent~~Vscrollbar

    oh...
    VB Code:
    1. 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???

  6. #6
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Urgent~~Vscrollbar

    VB Code:
    1. Set mPic = Picture1.Image

  7. #7

    Thread Starter
    Member
    Join Date
    Aug 2006
    Posts
    44

    Re: Urgent~~Vscrollbar

    VB Code:
    1. Private Sub Form_Load()
    2.     PicColor.Visible = False
    3.     RefreshButton.Enabled = False
    4.     'scrollMax = 51
    5.     'HScroll1.Max = scrollMax   ' Set maximum value.
    6.     'HScroll1.LargeChange = 3   ' Cross in 17 clicks.
    7.     'HScroll1.SmallChange = 1    ' Cross in 51 clicks.
    8.      With Picture2
    9.         .ScaleMode = vbPixels
    10.         .AutoRedraw = True
    11.        
    12.         Set mPic = picPV.Image 'LoadPicture("C:\mypic.bmp")  '(Load your picture in this line)
    13.        
    14.         mWidth = ScaleX(mPic.Width, vbHimetric, vbPixels)
    15.         mHeight = ScaleX(mPic.Height, vbHimetric, vbPixels)
    16.         .PaintPicture mPic, 0, 0
    17.     End With
    18.            
    19.     If mHeight > Picture2.ScaleHeight Then
    20.         With VScroll1
    21.             .Min = 0
    22.             .Max = mHeight - Picture2.ScaleHeight
    23.             .SmallChange = ((mHeight - Picture2.ScaleHeight) / 100) + 1
    24.             .LargeChange = ((mHeight - Picture2.ScaleHeight) / 10) + 1
    25.         End With
    26.     Else
    27.         VScroll1.Enabled = False
    28.     End If
    29.    
    30.     If mWidth > Picture2.ScaleWidth Then
    31.         With HScroll1
    32.             .Min = 0
    33.             .Max = mWidth - Picture2.ScaleWidth
    34.             .SmallChange = ((mWidth - Picture2.ScaleWidth) / 100) + 1
    35.             .LargeChange = ((mWidth - Picture2.ScaleWidth) / 10) + 1
    36.         End With
    37.     Else
    38.         HScroll1.Enabled = False
    39.     End If
    40. 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
  •  



Click Here to Expand Forum to Full Width