是否有一种解决方案可以为我的 VB.NET if 语句生成更好的输出。我试图通过在低于或高于这些值时将其设置为最小值和最大值来防止它被锁定。它有效,但输出并不那么迷人,即值来回反弹。
If MouseButtons = 1048576 Then ' On mouse down (within loop)
If Track >= TrackMin AndAlso Track <= TrackMax Then ' Evaluate and integrate mouse position if in range
Track = Track + (Yabs - SampleMouse) ' Do it
ElseIf Track < TrackMin Then ' If smaller than Trackmin
Track = TrackMin ' Use TrackMin to avoid locking if statement
ElseIf Track > TrackMax Then ' If Greater than TrackMax
Track = TrackMax ' Use TrackMax to avoid locking if statement
End If
End If