2009年7月16日 星期四

文字定位控制練習

image_thumb[1]

Public Class Form1
    Dim i
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim s = ""
        Dim a = "明天會更好"

        For i = 1 To 5
            '左下至右上()
            s = vbNewLine & Space(i * 3) & Mid(a, i, 1) & s
        Next
        For i = 1 To 5
            '左上至右下()
            s = s & vbNewLine & Space(i * 3) & Mid(a, i, 1)
        Next
        For i = 1 To 5
            '右上至左下
            s = s & vbNewLine & Space((6 - i) * 3) & Mid(a, i, 1)
        Next
        For i = 1 To 5
            '右下至左上
            s = vbNewLine & Space((6 - i) * 3) & Mid(a, i, 1) & s
        Next

        MsgBox(s)
    End Sub
End Class

沒有留言: