vb.netだけ間違いだと思う Dim bottomPosition As Integer = -1 For y = maxHeight - 1 To topPosition + 1 Step -1 For x = leftPosition To rightPosition If bmp.GetPixel(x, y).ToArgb() <> backColorArgb Then bottomPosition = y Exit For End If Next If 0 <= bottomPosition Then Exit For End If y -= 1 '←これいらない Next
通常のコメント 匿名2021/03/7 (Sun) 14:45:48
Function MeasureForegroundArea '下の空白部分を計測する For...Nextループ内最後の y -= 1 は、不要ではないでしょうか?
匿名 2022/01/15 (Sat) 04:24:34
Dim bottomPosition As Integer = -1
For y = maxHeight - 1 To topPosition + 1 Step -1
For x = leftPosition To rightPosition
If bmp.GetPixel(x, y).ToArgb() <> backColorArgb Then
bottomPosition = y
Exit For
End If
Next
If 0 <= bottomPosition Then
Exit For
End If
y -= 1 '←これいらない
Next