Jimmythegreat
Member
- Joined
- Jul 19, 2006
- Messages
- 17
- Programming Experience
- 3-5
I have a timer set to 1ms. In this timer I have the following code:
This, as you can see, makes the form appear to scroll off the screen without moving the form (the form can't be moved for various reasons). There are four if's because with only one it goes way to slow and it cannot go below 1.
The problem is that when doing this the process uses 100% of my CPU. Is there anyway to clean this up and make it less demanding or completely change it to do the same effect. I also have another timer that makes the width grow that is executed at a differant time, so any code would also have to work with that.
VB.NET:
For i = 0 To loopin 'loopin is how many pixels per loop
If Me.Width < xOrg Then 'xOrg is the forms width orginally
Me.Width = Me.Width + 1
Else
scrollIn.Enabled = False
End If
Next
This, as you can see, makes the form appear to scroll off the screen without moving the form (the form can't be moved for various reasons). There are four if's because with only one it goes way to slow and it cannot go below 1.
The problem is that when doing this the process uses 100% of my CPU. Is there anyway to clean this up and make it less demanding or completely change it to do the same effect. I also have another timer that makes the width grow that is executed at a differant time, so any code would also have to work with that.
Last edited by a moderator: