CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2001
    Posts
    6

    Using scrollbars.. Please help!


    Can someone help me with the code to use scrollbars? I'm having a picturebox in a frame
    which I need to move using the scrollbars.

    Urgent. Please help.

    Suresh.


  2. #2
    Join Date
    Sep 2001
    Posts
    7

    Re: Using scrollbars.. Please help!

    To move the picturebox itself , which is what you are trying to do i believe, place horisontal and vertical scrollbars in the frame , extend them to the frame extends, use the scroll bars scange event, and assign the picturebox "TOP" or "LEFT" property to the ScrollBar "VALUE" property. Look at the picture moves!
    Hope it helps.


  3. #3
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: Using scrollbars.. Please help!

    On a form put a frame and on the frame put a picturebox and a vert. scroll bar and try this code...


    private Sub Form_Load()
    'no border on frame
    Frame1.BorderStyle = 0
    'set pictbox coords in frame...
    Picture1.Top = Frame1.Top
    Picture1.Left = Frame1.Left
    Picture1.Picture = LoadPicture("Picturename.bmp")
    Picture1.Height = Picture1.Image.Height
    VScroll1.Min = 1
    VScroll1.Max = 100
    End Sub

    private Sub VScroll1_Change()
    Dim sPctNum as Single
    sPctNum = (Picture1.Height - Frame1.Height) * (VScroll1.Value / 100)
    Picture1.Top = -sPctNum
    End Sub





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

Featured