【问题标题】:bouncing caused by unlocking if statement VB.NET由解锁 if 语句 VB.NET 引起的弹跳
【发布时间】:2016-04-18 21:31:30
【问题描述】:

是否有一种解决方案可以为我的 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

【问题讨论】:

    标签: vb.net if-statement debouncing


    【解决方案1】:

    我所做的是用另一个 if 语句掩盖该语句。但是进入VB的两三周我真的不知道这是否接近优化的解决方案。它运作良好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多