Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. how to use scroll bar in pictur box

how to use scroll bar in pictur box

Scheduled Pinned Locked Moved Visual Basic
tutorial
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Piyush Vardhan Singh
    wrote on last edited by
    #1

    how to use scroll bar in pictur box

    Piyush Vardhan Singh

    C A J 3 Replies Last reply
    0
    • P Piyush Vardhan Singh

      how to use scroll bar in pictur box

      Piyush Vardhan Singh

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You'd have to write the code yourself to make the scrollbar have the right extent, and to move the image. IMO you're better off just drawing the image in your paint event, it makes scrolling easier to control.

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      1 Reply Last reply
      0
      • P Piyush Vardhan Singh

        how to use scroll bar in pictur box

        Piyush Vardhan Singh

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        Hi, Piyush :cool: I have one sollution for it... u shold like it !!! :-D ------------------------------------------------------------------ Step : 1 Take One Pannel Set AutoScroll=True :-D Step : 2 Take a picture Box, inside the pannel with same width and height !!! Set SizeMode=AutoSize ;) ----------------------------------------------------------------------- That's All ..... When ever u select a image whose size is greater than the picture width and height..... u will get both Horizantal and veritcal Scroll Bar....:-D Try it !!!!:laugh::laugh:

        Happy Programming ----- Abhijit

        P 1 Reply Last reply
        0
        • A Abhijit Jana

          Hi, Piyush :cool: I have one sollution for it... u shold like it !!! :-D ------------------------------------------------------------------ Step : 1 Take One Pannel Set AutoScroll=True :-D Step : 2 Take a picture Box, inside the pannel with same width and height !!! Set SizeMode=AutoSize ;) ----------------------------------------------------------------------- That's All ..... When ever u select a image whose size is greater than the picture width and height..... u will get both Horizantal and veritcal Scroll Bar....:-D Try it !!!!:laugh::laugh:

          Happy Programming ----- Abhijit

          P Offline
          P Offline
          Piyush Vardhan Singh
          wrote on last edited by
          #4

          my dear i had done this but its not working

          Piyush Vardhan Singh

          A D 2 Replies Last reply
          0
          • P Piyush Vardhan Singh

            my dear i had done this but its not working

            Piyush Vardhan Singh

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #5

            but its working fine for me !!!!

            Happy Programming ----- Abhijit

            1 Reply Last reply
            0
            • P Piyush Vardhan Singh

              my dear i had done this but its not working

              Piyush Vardhan Singh

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Did you put the PictureBox INSIDE the Panel control??

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007

              1 Reply Last reply
              0
              • P Piyush Vardhan Singh

                how to use scroll bar in pictur box

                Piyush Vardhan Singh

                J Offline
                J Offline
                JamesS C1
                wrote on last edited by
                #7

                Hello Piyush, I hope the following code helps: Private bWindowIsResizable As Boolean Private Const WM_NCLBUTTONDOWN = &HA1 Private Const HTBOTTOMRIGHT = 17 Private Declare Function SendMessage Lib "user32" _ Alias "SendMessageA" _ (ByVal hwnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ lParam As Any) As Long Private Declare Function ReleaseCapture Lib "user32" () As Long Private Sub Form_Load() HScroll1.Height = 255 VScroll1.Width = 255 'set flag indicating a resizable window bWindowIsResizable = (Me.BorderStyle = vbSizable) Or _ (Me.BorderStyle = vbSizableToolWindow) 'set up the picture box used to fill 'the corner between the H and V scroll 'bars, and if the window is sizable 'print a 'gripper' image to the control With Picture3 .AutoRedraw = True .AutoSize = True .ForeColor = &H80000015 .BackColor = Me.BackColor .BorderStyle = 0 .ZOrder 0 'if sizable windows print the gripper image If bWindowIsResizable Then .Font.Size = 11 .Font.Name = "Marlett" .Font.Bold = False Picture3.CurrentX = 10 Picture3.CurrentY = 10 Picture3.Print "o" End If End With With Picture1 .BorderStyle = 0 .Move 0, 0 .Cls End With With Picture2 'inner (cyan) picture box 'as we're loading an image, expand pix2 'to the size of the loaded graphic .AutoSize = True .BorderStyle = 0 .Move 0, 0 .Cls 'obviously, change this to a valid image on your system .Picture = LoadPicture("c:\windows\xp5layout.jpg") End With With HScroll1 .Max = (Picture2.ScaleWidth - Picture1.ScaleWidth) .LargeChange = .Max \ 10 .SmallChange = .Max \ 25 .Enabled = (Picture1.ScaleWidth <= Picture2.ScaleWidth) .ZOrder 0 End With With VScroll1 .Max = (Picture2.ScaleHeight - Picture1.ScaleHeight) .LargeChange = .Max \ 10 .SmallChange = .Max \ 25 .Enabled = (Picture1.ScaleHeight <= Picture2.ScaleHeight) .ZOrder 0 End With Picture3.ZOrder 0 End Sub Private Sub Form_Resize() 'Picture1 is the *outer* pix box (the red viewport) 'Picture2 is the inner pix box (the cyan container to scroll within the viewport) 'don't attempt resizing if minimized! If Me.WindowState <>

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups