Module resolution

    '// VGA画面をQVGAに変換する
    '//
    '//    CALL方法：各FormのLoad処理に以下のステートを追加する
    '//
    '//    If System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width = 240 Then
    '//        Call resolution.VGAtoQVGA(Me)
    '//    End If

    Public Sub VGAtoQVGA(ByRef top As Control)
        Dim all As Control() = GetAllControls(top)

        '// フォーム内の部品のサイズ調整
        For Each item As Control In all

            '// 縦横座標、幅＆高さ
            item.Left = item.Left * 0.5
            item.Top = item.Top * 0.5
            item.Width = item.Width * 0.5
            item.Height = item.Height * 0.5

            '// フォントサイズ
            Try
                item.Font = New Font(item.Font.Name, item.Font.Size * 0.5, item.Font.Style)
            Catch ex As NotSupportedException
                '// Font not implemented
            End Try

        Next


        '// フォーム自体のサイズ調整

        top.Left = top.Left * 0.5
        top.Top = top.Top * 0.5
        top.Width = top.Width * 0.5
        top.Height = top.Height * 0.5

        top.Font = New Font(top.Font.Name, top.Font.Size * 0.5, top.Font.Style)

    End Sub


    '// QVGA画面をVGAに変換する
    '//
    '//    CALL方法：各FormのLoad処理に以下のステートを追加する
    '//
    '//    If System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width = 480 Then
    '//        Call resolution.QVGAtoVGA(Me)
    '//    End If

    Public Sub QVGAtoVGA(ByRef top As Control)
        Dim all As Control() = GetAllControls(top)

        '// フォーム内の部品のサイズ調整
        For Each item As Control In all



            '// 縦横座標、幅＆高さ
            item.Left = item.Left * 2
            item.Top = item.Top * 2
            item.Width = item.Width * 2
            item.Height = item.Height * 2

            '// フォントサイズ
            Try
                item.Font = New Font(item.Font.Name, item.Font.Size * 2, item.Font.Style)
            Catch ex As NotSupportedException
                '// Font not implemented
            End Try

        Next


        '// フォーム自体のサイズ調整

        top.Left = top.Left * 2
        top.Top = top.Top * 2
        top.Width = top.Width * 2
        top.Height = top.Height * 2

        top.Font = New Font(top.Font.Name, top.Font.Size * 2, top.Font.Style)

    End Sub

    Public Function GetAllControls(ByVal top As Control) As Control()
        Dim buf As ArrayList = New ArrayList
        For Each c As Control In top.Controls
            buf.Add(c)
            buf.AddRange(GetAllControls(c))
        Next
        Return CType(buf.ToArray(GetType(Control)), Control())
    End Function
End Module
