' 隙間を求めるための割り算用 Const INT_SPACE_DIVISION As Integer = 2 ' 動画の幅 Dim iMovieW As Integer ' 動画の高さ Dim iMovieH As Integer ' 幅の隙間 Dim iSpaceW As Integer ' 高さの隙間 Dim iSpaceH As Integer ' 幅の倍率 Dim dMagnificationW As Double ' 高さの倍率 Dim dMagnificationH As Double ' 枠のサイズ Dim strViewSize As String = String.Empty ' 幅のアスペクト比を求める。 If iMovieW > iPnlW Then dMagnificationW = iMovieW / iPnlW Else dMagnificationW = iPnlW / iMovieW End If ' 表示場所(パネル)が再生中の動画よりサイズが大きくなったら拡大処理を行う。 If iPnlW > iMovieW And iPnlH > iMovieH Then If dMagnificationW > dMagnificationH Then iMovieW = CInt(Math.Floor(iMovieW * dMagnificationH)) iMovieH = CInt(Math.Floor(iMovieH * dMagnificationH)) Else iMovieW = CInt(Math.Floor(iMovieW * dMagnificationW)) iMovieH = CInt(Math.Floor(iMovieH * dMagnificationW)) End If Console.WriteLine("MciCommand.vb WindowSizeChange iMovieW: " & iMovieW) Console.WriteLine("MciCommand.vb WindowSizeChange iMovieH: " & iMovieH) ElseIf (iPnlW.Equals(iMovieW) Or iPnlH.Equals(iMovieH)) Then ' 幅か高さが同一なので処理しない。 ElseIf dMagnificationW < dMagnificationH Then iMovieW = CInt(Math.Floor(iMovieW / dMagnificationH)) iMovieH = CInt(Math.Floor(iMovieH / dMagnificationH)) ElseIf dMagnificationW > dMagnificationH Then iMovieW = CInt(Math.Floor(iMovieW / dMagnificationW)) iMovieH = CInt(Math.Floor(iMovieH / dMagnificationW)) End If iSpaceW = CInt(Math.Floor(iPnlW - iMovieW) / INT_SPACE_DIVISION) iSpaceH = CInt(Math.Floor(iPnlH - iMovieH) / INT_SPACE_DIVISION)