-
ok, three very simple questions.
How can I check to see if a button is being held down?
I'm trying to increment a number when a button is pressed. How can I continue to increment that number if a button is pressed and held?
I'm also looking for some examples of pseudo-3d code. I understand this isn't assembly, but there has to be some examples out there. Vector examples or something.
Is it possible to change a PictureBox image?
-
<?>
[code]
1. Forget it how would you know how many to increment
2. Don't know
3. Yes....
Set Picture1.Picture = LoadPicture("C:\myfile.jpg")
[code]
-
Use the UpDown control
Can you use an UpDown control? Try this on a sample project and see if it will work for you. Its in the common controls.
Code:
Option Explicit
Dim iNum As Integer
Private Sub Form_Load()
iNum = 10
Text1.Text = iNum
End Sub
Private Sub UpDown1_DownClick()
iNum = iNum - 1
Text1.Text = iNum
End Sub
Private Sub UpDown1_UpClick()
iNum = iNum + 1
Text1.Text = iNum
End Sub
-
Better
You want it to imcrement while its held down, don't you? Start a project, put 2 Command buttons, cmdUp and cmdDown. Put 2 timers tmr Up and tmrDown and Text box Text1. Paste in this code and see if it does what you want.
Code:
Dim iNum As Integer
Private Sub cmdUp_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
tmrUp.Enabled = True
End Sub
Private Sub cmdUp_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
tmrUp.Enabled = False
End Sub
Private Sub Form_Load()
iNum = 10
Text1.Text = iNum
tmrUp.Interval = 100
tmrDown.Interval = 100
tmrUp.Enabled = False
tmrDown.Enabled = False
End Sub
Private Sub tmrDown_Timer()
iNum = iNum - 1
Text1.Text = iNum
End Sub
Private Sub tmrUp_Timer()
iNum = iNum + 1
Text1.Text = iNum
End Sub
Private Sub cmdDown_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
tmrDown.Enabled = False
End Sub
Private Sub cmdDown_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
tmrDown.Enabled = True
End Sub
I think this will do what you want.