borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2010 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (change command botton forecolor (font color))Next Topic (Add Controls at Runtime) New Topic New Poll Post Reply
AndreaVB Forum : VB General : PictureBox with scrollbar
Poster Message
arti
Level: Guest


Ads by Lake Quincy Media
icon PictureBox with scrollbar

I have to attach scrollbar to picture box.
Actually i have attached it but when i drag
on the picture it doesn't move.

Can anybody help me to write that code.

Ads by Lake Quincy Media
29-12-2002 at 12:21 PM
| Quote Reply
tisbj
Level: Guest

icon Re: PictureBox with scrollbar

This isn't really code, but it may help.  When you created the scroll bar, did you click the scroll bar icon and "draw" it INSIDE the picture box?  If not, it is not considered part of the picture box.

30-12-2002 at 02:15 PM
| Quote Reply
vbgen
Level: Moderator

Registered: 10-10-2002
Posts: 876
icon Re: PictureBox with scrollbar

quote:
arti wrote:
I have to attach scrollbar to picture box.
Actually i have attached it but when i drag
on the picture it doesn't move.

Can anybody help me to write that code.


here's code for a scrollbar, but the drag thingy you want on the picturebox i'll work on in a while yet.



Private Sub Form_Load()

    ' Set ScaleMode to pixels.
    Form1.ScaleMode = 6
    Picture1.ScaleMode = 6

    ' Autosize is set to True so that the boundaries of
    ' Picture2 are expanded to the size of the actual
    ' bitmap.
    Picture2.AutoSize = True

    ' Set the BorderStyle of each picture box to None.
    Picture1.BorderStyle = 0
    Picture2.BorderStyle = 0

    ' Load the bitmap.
    Picture2.Picture = _
    LoadPicture("c:windowsBackgrnd.gif")

    ' Initialize location of both pictures.
    Picture1.Move 0, 0, ScaleWidth - VScroll1.Width, ScaleHeight - HScroll1.Height
    Picture2.Move 0, 0

    ' Position the horizontal scroll bar.
    HScroll1.Top = Picture1.Height
    HScroll1.Left = 0
    HScroll1.Width = Picture1.Width

    ' Position the vertical scroll bar.
    VScroll1.Top = 0
    VScroll1.Left = Picture1.Width
    VScroll1.Height = Picture1.Height

    ' Set the Max property for the scroll bars.
    HScroll1.Max = Picture2.Width - Picture1.Width
    VScroll1.Max = Picture2.Height - Picture1.Height

    ' Determine if the child picture will fill up the
    ' screen.
    ' If so, there is no need to use scroll bars.
    VScroll1.Visible = (Picture1.Height < Picture2.Height)
    HScroll1.Visible = (Picture1.Width < Picture2.Width)

End Sub
    
Private Sub HScroll1_Change()
    Picture2.Left = -HScroll1.Value
End Sub

Private Sub VScroll1_Change()
    Picture2.Top = -VScroll1.Value
End Sub
    
Private Sub Form_Resize()
    ' When the form is resized, change the Picture1
    ' dimensions.
    Picture1.Height = Form1.Height
    Picture1.Width = Form1.Width

    ' Reinitialize the picture and scroll bar
    ' positions.
    Picture1.Move 0, 0, ScaleWidth - VScroll1.Width, ScaleHeight - HScroll1.Height
    Picture2.Move 0, 0
    HScroll1.Top = Picture1.Height
    HScroll1.Left = 0
    HScroll1.Width = Picture1.Width
    VScroll1.Top = 0
    VScroll1.Left = Picture1.Width
    VScroll1.Height = Picture1.Height
    HScroll1.Max = Picture2.Width - Picture1.Width
    VScroll1.Max = Picture2.Height - Picture1.Width

    ' Check to see if scroll bars are needed.
    VScroll1.Visible = (Picture1.Height < Picture2.Height)
    HScroll1.Visible = (Picture1.Width < Picture2.Width)

End Sub
    


i'll get back to this post later, okay, arti?



by the way, the picturebox 2 is inside picturebox 1, and the scrollbars are outside both boxes

[Edited by vbgen on 31-12-2002 at 01:30 AM GMT]

____________________________
Been busy trying to take a second degree <--it's not working out...
30-12-2002 at 05:29 PM
View Profile Send Email to User Show All Posts | Quote Reply
unnibiju
Level: Guest

icon Re: exe should satrt when windows startup

i want to run my exe when windows startinf up,i have already
put the icon in tray while minimising the aplication and from it can start, but now i want my exe should load when windows start up, from there the user will minimise it

09-02-2003 at 12:51 PM
| Quote Reply
vbgen
Level: Moderator

Registered: 10-10-2002
Posts: 876
icon Re: exe should satrt when windows startup

quote:
unnibiju wrote:
i want to run my exe when windows startinf up,i have already
put the icon in tray while minimising the aplication and from it can start, but now i want my exe should load when windows start up, from there the user will minimise it



welcome to the forum, unnibiju...

don't be afraid to start a new thread, i mean post a NEW topic... as long as the topic doesn't exist yet...

for your question, well, if you know how to use registry modules or classes, and if you have the codes already... you just have to add your app's name and its location ot this path in the registry:

My ComputerHKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionRun

well, if you want to make your program run just once...
just change Run to RunOnce...


    

____________________________
Been busy trying to take a second degree <--it's not working out...
10-02-2003 at 01:24 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : PictureBox with scrollbar
Previous Topic (change command botton forecolor (font color))Next Topic (Add Controls at Runtime) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2010 Andrea Tincaniborder