| Sin, TextWidth |
| |
| |
| Private Sub Form_Load() | |
| picAusgabe.Scale (0, 0)-(100, 100) |
| picAusgabe.Left = 0 |
| picAusgabe.Width = Me.ScaleWidth - 80 |
| chkMulticolor.Value = 1 |
| End Sub |
| |
| Private Sub txtAusgabe_LostFocus() | |
| Call macro1 | |
| End Sub | |
| |
| Private Sub chkMulticolor_KeyDown(KeyCode As Integer, Shift As Integer) |
| Call macro1 | |
| End Sub | |
| |
| Sub macro1() | |
| Dim Anzeigetext As String | |
| Dim sYPosition As Single | |
| Dim n As Integer | |
| Anzeigetext = txtAusgabe.Text | |
| If Len(Anzeigetext) = 0 Then Exit Sub | |
| picAusgabe.Font.Size = 36 | |
| picAusgabe.Cls | Über die TextWidth-Methode erhält man die Breite einer |
| Do | Zeichenkette bezogen auf die Ausgabefläche. |
| picAusgabe.Font.Size = picAusgabe.Font.Size - 2 | Der Font passt sich der Menge der Zeichen an. |
| Loop Until picAusgabe.TextWidth(Anzeigetext) < picAusgabe.ScaleHeight |
| picAusgabe.CurrentX = (picAusgabe.ScaleWidth - picAusgabe.TextWidth(Anzeigetext)) \ 2 |
| sYPosition = (picAusgabe.ScaleHeight - picAusgabe.TextHeight(Anzeigetext)) \ 2 |
| For n = 1 To Len(Anzeigetext) | Schleifenverabeitung. |
| picAusgabe.CurrentY = Sin(n * 0.75) * 2 + sYPosition | Sinus-Rechenoperation. |
| If chkMulticolor.Value = 1 Then | |
| picAusgabe.ForeColor = QBColor(n Mod 15) | Farbige Zeichen. |
| End If | |
| picAusgabe.Print Mid(Anzeigetext, n, 1); | Ausgabe des Textes. |
| Next n | |
| End Sub | |
| |