how to use scroll bar in pictur box
-
how to use scroll bar in pictur box
Piyush Vardhan Singh
-
how to use scroll bar in pictur box
Piyush Vardhan Singh
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 )
-
how to use scroll bar in pictur box
Piyush Vardhan Singh
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
-
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
my dear i had done this but its not working
Piyush Vardhan Singh
-
my dear i had done this but its not working
Piyush Vardhan Singh
but its working fine for me !!!!
Happy Programming ----- Abhijit
-
my dear i had done this but its not working
Piyush Vardhan Singh
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 -
how to use scroll bar in pictur box
Piyush Vardhan Singh
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 <>