|
Sub Skala(Ziel As Object)
Dim Breite As Integer
Dim Mitte As Integer
Dim MaxH As Integer
Dim m As Integer, x As Integer
Dim H As Integer, F As Integer
Dim Y As Integer, XX As Integer
Breite = CInt(Ziel.ScaleWidth)
Mitte = CInt(Ziel.ScaleHeight \ 2)
MaxH = Mitte - 10
Ziel.DrawWidth = 1
For m = 0 To Breite \ 10
x = m * 10
H = 20
F = 12
Y = Mitte - 10
If (x / 10 Mod 10 = 0) And x <= Breite Then
H = 30
F = 1
Y = Mitte - 15
Ziel.CurrentY = Y - Ziel.TextHeight(x \ 10)
XX = x - (Ziel.TextWidth(x \ 10)) / 2
If XX < 0 Then XX = 0
Ziel.CurrentX = XX
Ziel.ForeColor = 0
Ziel.Print x \ 10
End If
Ziel.Line (x, Y)-Step(0, H), QBColor(F)
Next
Ziel.PSet (0, Mitte)
Ziel.Line -Step(Breite * 10, 0), QBColor(0)
End Sub
Sub Sinuskurve(Ziel As Object, Optional Anfg As Integer = 0, _
Optional Abst As Integer = 10, Optional Farbe As Long = 0)
Dim Pi As Double
Dim Wf As Double
Dim x As Integer
Dim m As Double
Dim Breite As Integer
Dim Mitte As Integer
Dim MaxH As Integer
Pi = 4 * Atn(1)
Wf = (Pi / Abst) * 2
Breite = CInt(Ziel.ScaleWidth)
Mitte = CInt(Ziel.ScaleHeight \ 2)
MaxH = Mitte - 10
Ziel.ForeColor = QBColor(Farbe)
Ziel.PSet (0, Mitte)
Ziel.DrawWidth = 1
For m = 0 To Breite
x = m * 10
Ziel.Line -(Anfg + x, Mitte - MaxH * (Sin(Wf * _
(((m) Mod (Abst))))))
Next
End Sub
Private Sub Form_Load()
HScroll1_Change 0
End Sub
Private Sub HScroll1_Change(Index As Integer)
Label1(Index) = HScroll1(Index).Value
Picture1.Cls
Sinuskurve Picture1, , Val(Label1(0)), 9
Sinuskurve Picture1, , Val(Label1(1)), 12
Sinuskurve Picture1, , Val(Label1(2)), 2
Skala Picture1
End Sub
Private Sub HScroll1_Scroll(Index As Integer)
Label1(Index) = HScroll1(Index).Value
End Sub
|
|