I am working on a number line to teach kids how to skip count numbers. So basically I have a numberline in a picturebox called picPicture. That one is inside another picturebox called picWindow (I got this code off here). : )
So the picturebox scrolls, but the problems is I can't scroll as far as I want.
The number line image file goes from 0-100. The box will only let me scroll up to 39(ish).
Would anyone know of a way to make it scroll to 100?
Thanks!
Here is my code.
VB Code:
Option Explicit
' You have a royalty-free right to use, modify, reproduce and distribute
' the Sample Application Files (and/or any modified version) in any way
' you find useful, provided that you agree that Martin Liss has no warranty,
' obligations or liability for any Sample Application Files.
Private Sub Form_Activate()
' So that scrooling will happen if the user immediately presses
Make your inner picture picPicture's Height high enough to allow for the max number of lines. Also you need to make sure your scrollbar settings are correct so it will scroll the entire picture up and down
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
Hi there! Do I need to add a vertical scroll bar? The picture's height will stay the same, it just needs to scroll left to right because the number line is soooo big. I try to enter say 300 000 as the width of the picPicture, but it won't scroll any further than if I put say 100 000 for the width value.
I read your post wrong. I thought you were talking about a vertical problem.
What scale mode are you using on the picturebox
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
ScaleMode means Pixels or Twips or some other mode. It should be in Pixels
The .Value, .SmallChange, .LargeChange, .Min, and .Max, properties of a scrollbar are all Integer variable meaning you can't have values greater than 32,767. So if your picturebox has a width greater than 32,767 you wont be able to scroll the full width of the picturebox.
What is the width of your inner picturebox. What is the width of each line
What are your values for .Min, .Max
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
With some calculations and some drawing you can dispense with the "dueling PictureBox" approach altogether. And for that matter do you really need a scrollbar? You could still use one of course.
With some calculations and some drawing you can dispense with the "dueling PictureBox" approach altogether. And for that matter do you really need a scrollbar? You could still use one of course.
Very nice demo. Your code is always neat and beautiful.
Thanks for the concept and sample.
That is awesome, and I am sorry for the late reply. I have used this and the kids like it because visual learners love this stuff. I hate to bother, but I was wondering if you could, or could show me how to add something.
I use the program to show students that you can turn a subtraction problem into adding, but starting with the small number and "jumping" to the big one. Ex: 19 - 6 = 13
The student can start at 6, and make jumps by clicking on the next number. So if I could, I can click on 6, and then 10 because kids like 10. Usually on the board I would draw an arch between those number to visualize the jump. Then keep jumping to 19, then add the jumps. So a jump from 6 to 10 would be 4, then 10 to 19 would be 9, so 4 + 9 = 13.
I don't know how, but if the user could click on a number, then click on another number, then an arch would be drawn between those two numbers, that would be awesome!
Sorry if it seems like I'm asking for much!
P.S. LaVople posted this in another thread. It draw 180 degree archs once the user clicks on two points.
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If bNeed2ndPoint Then
Picture1.Circle (X, Y), 5, vbBlack
tPts(1).X = X: tPts(1).Y = Y
bNeed2ndPoint = False
DrawArcPoints Picture1
Else
Picture1.Cls
Picture1.Circle (X, Y), 5, vbBlack
tPts(0).X = X: tPts(0).Y = Y
bNeed2ndPoint = True
End If
End Sub
This code does help big time. I am just wondering if there was a way to make the arcs not too high? Also is there a way to keep the arcs after they are made to stay "drawn" on the picturebox? Ideally I would like the arcs to move along with the number line as you go forwards and backwards.
Last edited by Justin M; Apr 20th, 2016 at 04:52 AM.
It looks like a common core lesson to me. Being an old fart, I say ditch the idea of teaching kids the common core BS and stick with something a little less abstract.
... . I am just wondering if there was a way to make the arcs not too high? Also is there a way to keep the arcs after they are made to stay "drawn" on the picturebox? Ideally I would like the arcs to move along with the number line as you go forwards and backwards.
Well, the code could be modified, but it would take a bit of math. 180 degrees is easy, but to keep the arc low you have to have the angle vary and the radius would have to vary to be the distance based on a chord of the circle, the chord being based on the desired height of the arc and the distance between the numbers.
Actually, thinking about it, it probably isn't too hard, just a few steps of basic trigonometry, but in this case another approach might actually be easier.
If you had an image of an arc the right vertical size that was sized horizontally to go between two adjacent numbers of your number line, you could use the Paint statement to stretch that image horizontally however many spaces you needed.
As far as making it "stick", or multiple copies of it "stick" to the drawing, I would need to checkout dilettante's code to see how he is drawing the numberline to see how to fit any new drawing code into it. I probably won't be looking at it anytime soon, so maybe someone else will come along and carry on.