-2
나는 며칠 동안 노력해 왔으며 여기서 논리를 파악할 수 없습니다. 수건에 던지기.for 루프 내의 명령문이 루프상에서 실행되지 않는 경우
저는 이미지 객체를 가지고 있습니다. 10 "x 8"격자의 동등한 셀로 잘라야합니다. 10 번째 열 뒤에는 다음 행으로 떨어지고 이후 10 개의 열을 모으는 식으로 진행됩니다. 나는 그것을 다음 행으로 돌아가서 그 행을 유지하는 것, 오히려 하나의 셀을 가져 와서 첫 번째 행으로 되돌아가는 것처럼 보인다.
$startColumn = 1
$currentCell = 1
$currentColumn = 1
$currentRow = 1
For($i = 1; $i -lt 81; $i++)
{
$startleftCoord = 292
$starttopCoord = 87
$startrightCoord = 390
$startbottomCoord = 162
$cellheight = 75
$cellwidth = 98
if ($firstiterationcomplete -eq 1) {
"Changing columns"
$startleftCoord = $startleftCoord+($currentColumn*$cellwidth)+(4.05*$currentColumn)
$startrightCoord = $startrightCoord+($currentColumn*$cellwidth)+(4.05*$currentColumn)
if ($currentColumn -eq 9) {
"Changing Rows"
$currentRow++
$currentColumn = $startColumn
$startleftCoord = $startleftCoord
$startrightCoord = $startrightCoord
$starttopCoord = $starttopCoord+($currentRow*$cellheight)+(4.25*$currentRow)
$startbottomCoord = $startbottomCoord+($currentRow*$cellheight)+(4.25*$currentRow)
}
}
"Curent column is " + $currentColumn
"Row count is " + $currentRow
#save cellshot
$cellBounds = [Drawing.Rectangle]::FromLTRB($startleftCoord,$starttopCoord, $startrightCoord, $startbottomCoord)
$cellObject = New-Object Drawing.Bitmap $cellBounds.Width, $cellBounds.Height
$cellGraphics = [Drawing.Graphics]::FromImage($cellObject)
$cellGraphics.CopyFromScreen($cellBounds.Location, [Drawing.Point]::Empty, $cellBounds.Size)
$cellGraphics.Dispose()
$cellObject.Save($FilePath)
$currentColumn++
$currentCell++
$firstiterationcomplete = 1
"Saved CELLSHOT to $FilePath."
}
을 건너 뛰는 다음과 같은 이유에 대한 간단한 설명을 누락? 귀하의 코드는 더 PHP, 파이썬, 또는 foreach 루프가 포함되어 있지 않습니다. – melpomene
단지로 편집 for 루프를 포함해서 ... 나는 전문직이 아니며 일을 끝내려고 노력한다. powershell이다. –
PHP와 Python 및 foreach에 태그를 붙인 이유는 무엇입니까? – melpomene