$event:=FORM Event:C1606

$picturesize:=600

Case of 
	: ($event.code=On Scroll:K2:57)
		OBJECT GET SCROLL POSITION:C1114(*; "Input"; $scrollv; $scrollh)
		Form:C1466.scrollv:=$scrollv
		Form:C1466.scrollh:=$scrollh
		PICTURE PROPERTIES:C457(Form:C1466.selectedPicture.Picture; $width; $height)
		If ($width>$picturesize) & ($height>$picturesize)  //ピクチャーが幅・高さともエリアより大きい
			$rate1:=$scrollh/($width-$picturesize)
			$rate2:=$scrollv/($height-$picturesize)
			
			PICTURE PROPERTIES:C457(Form:C1466.selectedPicture.Thumbnail; $thumbwidth; $thumbheight)
			OBJECT GET COORDINATES:C663(*; "Rectangle"; $l; $t; $r; $b)
			$thumbscrollh:=($thumbwidth-($r-$l))*$rate1
			$thumbscrollv:=($thumbheight-($b-$t))*$rate2
			OBJECT SET COORDINATES:C1248(*; "Rectangle"; Form:C1466.thumbnailLeft+$thumbscrollh; Form:C1466.thumbnailTop+$thumbscrollv; Form:C1466.thumbnailLeft+($r-$l)+$thumbscrollh; Form:C1466.thumbnailTop+($b-$t)+$thumbscrollv)
		Else 
			Case of 
				: ($width<$picturesize) & ($height<$picturesize)  //ピクチャーが幅・高さともエリアより小さい
					//スクロールしない
				: ($width<$picturesize)  //ピクチャーが、エリアより幅は狭いが高さが大きい
					$rate2:=$scrollv/($height-$picturesize)
					
					PICTURE PROPERTIES:C457(Form:C1466.selectedPicture.Thumbnail; $thumbwidth; $thumbheight)
					OBJECT GET COORDINATES:C663(*; "Rectangle"; $l; $t; $r; $b)
					$thumbscrollv:=($thumbheight-($b-$t))*$rate2
					OBJECT SET COORDINATES:C1248(*; "Rectangle"; $l; Form:C1466.thumbnailTop+$thumbscrollv; $r; Form:C1466.thumbnailTop+($b-$t)+$thumbscrollv)
				: ($height<$picturesize)  //ピクチャーが、エリアより高さは小さいが幅が大きい
					$rate1:=$scrollh/($width-$picturesize)
					
					PICTURE PROPERTIES:C457(Form:C1466.selectedPicture.Thumbnail; $thumbwidth; $thumbheight)
					OBJECT GET COORDINATES:C663(*; "Rectangle"; $l; $t; $r; $b)
					$thumbscrollh:=($thumbwidth-($r-$l))*$rate1
					OBJECT SET COORDINATES:C1248(*; "Rectangle"; Form:C1466.thumbnailLeft+$thumbscrollh; $t; Form:C1466.thumbnailLeft+($r-$l)+$thumbscrollh; $b)
				Else   //それ以外
					//TRACE
			End case 
		End if 
End case 

