| |

VerySource

 Forgot password?
 Register
Search
View: 907|Reply: 2

How to make a picturebox with scroll bars and a container

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-19 22:30:01
| Show all posts |Read mode
How to make a picturebox with scroll bars and a container
For example, put a buttom inside and drag the scroll bar to see its position change.

Simply put, now I need to make a bigger puzzle
Jigsaw puzzles are basemaps and there are many small maps on top of the basemap. The screen is not large enough. I need a scroll bar, I hope you guys in vb can help. I have been thinking about it for a long time.
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-8-17 22:30:01
| Show all posts
With two PictureBox controls, first add a PictureBox control Picture1 to the form, and then use the mouse to load another PictureBox control Picture2 in the middle of Picture1.
Add a HScroll control to the body or in Picture1 to adjust the height of Picture2.
It is recommended not to use the vertical scroll bar at the same time as the horizontal scroll bar, as it will report an error or crash.
code show as below:

Private Sub Form_Load()
Me.Height = 11295
Me.Width = 15360
Picture1.Width = Me.Width-400
'Picture2.Height = Picture1.Height
Picture2.Width = Picture1.Width * 2.1'The magnification can be adjusted
End Sub

Private Sub HScroll1_Change()
Picture2.Left = -HScroll1 * 1.4 / 2.8' magnification needs to be adjusted
End Sub
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-8-18 01:45:01
| Show all posts
Private Sub Form_Load()
Me.Height = 11295
Me.Width = 15360
Picture1.Width = Me.Width-400
'Picture2.Height = Picture1.Height
Picture2.Width = Picture1.Width * 2.1'The magnification can be adjusted
HScroll1.SmallChange = 100
End Sub

Private Sub HScroll1_Change()
Picture2.Left = -HScroll1 * 1.4 / 2.8' magnification needs to be adjusted
End Sub
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list