VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsZeichnePfeil"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private m_LPfeil As Single
Private m_WinkelGrad As Single
Private m_t As Single
Private m_z As Single
Private WinkelBogen As Single
Private x_Koord As Single
Private y_Koord As Single
Private lp As Single
Private AlphaK As Single
Private AlphaWu As Single
Private AlphaWo As Single
Private dxu As Single
Private dyu As Single
Private dxo As Single
Private dyo As Single
Private xo!, yo!, xu!, yu!      'Single-Deklaration
Const Farbe1 = 12
Const Farbe2 = 9
Const PI = 3.141529

Public Property Get LPfeil() As Single
  LPfeil = m_LPfeil
End Property

Public Property Let LPfeil(ByVal NeuLPfeil As Single)
  m_LPfeil = NeuLPfeil
End Property

Public Property Get WinkelGrad() As Single
  WinkelGrad = m_WinkelGrad
End Property

Public Property Let WinkelGrad(ByVal NeuWinkelGrad As Single)
  m_WinkelGrad = NeuWinkelGrad
End Property

Public Property Get t() As Single
  t = m_t
End Property

Public Property Let t(ByVal st As Single)
  m_t = st
End Property

Public Property Get z() As Single
  z = m_z
End Property

Public Property Let z(ByVal sz As Single)
  m_z = sz
  Call BerechneKoordinaten
End Property

Public Sub ZeichneDiagramm(Picture1 As PictureBox)
'PictureBox darstellen
  Form1.Picture1.BorderStyle = 0
  Form1.Picture1.BackColor = &HE0E0E0
  Form1.Picture1.Width = 5655
  Form1.Picture1.Height = 5655
  Form1.Picture1.Left = 120
  Form1.Picture1.Top = 240
'KoordinatenAchsen unten und mittig
  Dim xA, xE, SchrittX
  Dim yA, yE, SchrittY
  Dim zX, zY, DeltaX, DeltaY, X, Y, k
   xA = -100: xE = 100: SchrittX = 20
   yA = -100: yE = 100: SchrittY = 20
   zX = 5: zY = zX + 3
   DeltaX = 15: DeltaY = 10
   Form1.Picture1.Scale (xA - DeltaX, yE + DeltaY)-(xE + DeltaX, yA - DeltaY)
  'Show
  Form1.Picture1.AutoRedraw = True

  If Form1.Option1 = True Then   'LINIENRASTER
    'Senkrechte Linien
    For X = xA To xE Step SchrittX
       Form1.Picture1.Line (X, yA)-(X, yE), QBColor(2)
    Next
    
    'Waagerechte Linien
    For Y = yA To yE Step SchrittY
       Form1.Picture1.Line (xA, Y)-(xE, Y), QBColor(2)
    Next
    'Koordinatenachsen zeichnen
     Form1.Picture1.Line (xA, 0)-(xE + zY, 0), QBColor(15)    'x-Achse
     Form1.Picture1.Line (0, yA)-(0, yE + zY), QBColor(15)    'y-Achse
  Else                           'PUNKTRASTER
    'Koordinatenachsen zeichnen
     Form1.Picture1.Line (xA, 0)-(xE + zY, 0), QBColor(15)    'x-Achse
     Form1.Picture1.Line (0, yA)-(0, yE + zY), QBColor(15)    'y-Achse
    For Y = yA To yE Step SchrittY
      For X = xA To xE Step SchrittX
         Form1.Picture1.PSet (X, Y), QBColor(0)
      Next
    Next
  End If

'Pfeilspitze an X-KoordinatenLinie, rechts
   Form1.Picture1.Line (xE + zY, 0)-(xE + 2, 2), QBColor(15)
   Form1.Picture1.Line (xE + zY, 0)-(xE + 2, -2), QBColor(15)

'Pfeilspitze an Y-KoordinatenLinie, oben
   Form1.Picture1.Line (0, yE + zY)-(-2, yE + 2), QBColor(15)
   Form1.Picture1.Line (0, yE + zY)-(2, yE + 2), QBColor(15)

'Beschriftung der Y-Achse
  Form1.Picture1.ForeColor = QBColor(0)
  For Y = yA To yE Step SchrittY
     Form1.Picture1.CurrentY = Y + 2
     Form1.Picture1.CurrentX = -8     'Korrekturwert
  Next
  
'Beschriftung der Y-Achse (mit If Then)
  For Y = yA To yE Step SchrittY
     Form1.Picture1.CurrentY = Y + 2
     If Y = 0 Then
      'k = 5
      GoTo weiter
     ElseIf Y > 99 Then
      k = 0.6
     Else
      k = 3
     End If
     Form1.Picture1.CurrentX = k     'Korrekturwert
     Form1.Picture1.Print Y
weiter:
  Next

'Beschriftung der X-Achse
  For X = xA To xE Step SchrittX
     Form1.Picture1.CurrentY = -2
     Form1.Picture1.CurrentX = X - 3 'Korrekturwert
     Form1.Picture1.Print X
  Next
  
'Achsen benennen
  Form1.Picture1.ForeColor = QBColor(12)
  Form1.Picture1.CurrentY = yE + zY
  Form1.Picture1.CurrentX = 4
  Form1.Picture1.Print "Y"

  Form1.Picture1.CurrentY = 3
  Form1.Picture1.CurrentX = xE + 2 * zX
  Form1.Picture1.Print "X"

  Form1.Picture1.AutoRedraw = False
End Sub

Private Sub BerechneKoordinaten()
  WinkelBogen = PI * WinkelGrad / 180
  x_Koord = LPfeil * Cos(WinkelBogen)
  y_Koord = LPfeil * Sin(WinkelBogen)
  If x_Koord = 0 Then x_Koord = 0.000001
  lp = Sqr(z ^ 2 + t ^ 2)
  AlphaK = Atn(t / z)
  AlphaWu = WinkelBogen + AlphaK
  dxu = lp * Cos(AlphaWu)
  dyu = lp * Sin(AlphaWu)
  AlphaWo = WinkelBogen - AlphaK
  dxo = lp * Cos(AlphaWo)
  dyo = lp * Sin(AlphaWo)
    xo = x_Koord - dxo
    yo = y_Koord - dyo
    xu = x_Koord - dxu
    yu = y_Koord - dyu
  Form1.Picture1.Line (x_Koord, y_Koord)-(xu, yu), QBColor(Farbe1)
  Form1.Picture1.Line (x_Koord, y_Koord)-(xo, yo), QBColor(Farbe1)
  Form1.Picture1.Line (xo, yo)-(xu, yu), QBColor(Farbe1)
  Form1.Picture1.Line (x_Koord, y_Koord)-(0, 0), QBColor(Farbe2)
End Sub
