Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Just some quick code on how to get snazzy scrollba...
Author:
Andrew Armstrong
E-mail:
Click to e-mail author
Submitted:
3/29/2001
Version:
VB5
Compatibility:
VB5, VB6
Category:
Forms
Views:
11761
Just some quick code on how to get snazzy scrollbars on a picture box. I know many ocx controls which do this poorly, especially when it is so simple!
Declarations:
Instructions! 1) Open up a new form 2) Paste a frame onto the form 3) set the frame to have no caption or border etc 4) paste vertical and horizontal scroll bars onto the form (not into the frame) 5) paste a picturebox into the frame if you left the control names as default the code prob needs not to be changed. Just make sure you pass initpicture an appropriate filename, perhaps from an open/save common control. Let me know if this was useful to you.
Code:
' Insert this code in the initialise portion prior to displaying (after loading your image into the picturebox). Public Sub initpicture(byval imagefile as string) ' These set the attributes for the scroll bars and load the image etc form1.Picture1.visible = false form1.picture1.autoredraw = true form1.picture1.autosize = true form1.picture1.picture = loadpicture(imagefile) Form1.HScroll1.Max = Form1.Picture1.Width + Form1.HScroll1.Min - Form1.Frame1.Width - 1 Form1.VScroll1.Max = Form1.Picture1.Height + Form1.VScroll1.Min - Form1.Frame1.Height - 1 Form1.HScroll1.SmallChange = Form1.Picture1.Width \ 20 'set small changes to 5% of images size Form1.HScroll1.LargeChange = Form1.Picture1.Width \ 10 'set large changes to 10% of image size Form1.VScroll1.SmallChange = Form1.Picture1.Height \ 20 Form1.VScroll1.LargeChange = Form1.Picture1.Height \ 10 Form1.picture1.visible = true 'Lets see what we got! End sub ' These are the procedures that control the scrolling etc Public Sub VScroll1_Change() Picture1.Top = Frame1.Top - VScroll1.value End Sub Private Sub VScroll1_Scroll() Call VScroll1_Change End Sub Public Sub HScroll1_Change() Picture1.Left = Frame1.Left - HScroll1.value End Sub Private Sub HScroll1_Scroll() Call HScroll1_Change End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement