Also es gibt die Klassen cTisch, cWände etc das sind die einzelnen Elemente. Diese sind einer Klasse zugeordnet wie cBüro ein Büro gehört zu einer Etage und eine Etage gehört zu einem Haus. Ich hab mal die Klasse Büro hinzugefügt (gekürtzt) und die Klasse cTisch. Ich hoffe es hift dir ein wenig weiter. Den Code als Klassenmodul einfügfen.
Klasse cTisch:
Option Explicit
Public X1 As Double
Public Y1 As Double
Public X2 As Double
Public Y2 As Double
Public Fillstyle As Integer
Private privId As Long
Private Sub Class_Initialize()
X1 = 0
Y1 = 0
X2 = 0
Y2 = 0
Fillstyle = 0
End Sub
Private Sub Class_Terminate()
X1 = 0
Y1 = 0
X2 = 0
Y2 = 0
Fillstyle = 0
End Sub
Public Property Get id() As Long
id = privId
End Property
Public Property Let id(id As Long)
privId = id
End Property
Public Sub Draw(picBox As PictureBox, ByVal ZoomFaktor As Double, ByVal SchiebX _
As Double, ByVal SchiebY As Double)
picBox.FillColor = vbBlack
picBox.ForeColor = vbBlack
If Not Fillstyle = 9 Then
picBox.Fillstyle = Fillstyle
picBox.Line (((X1 + SchiebX) * ZoomFaktor), ((Y1 + SchiebY) * ZoomFaktor))-( _
((X2 + SchiebX) * ZoomFaktor), ((Y2 + SchiebY) * ZoomFaktor)), vbBlack, B
Else
picBox.DrawWidth = 3
picBox.Line (((X1 + SchiebX) * ZoomFaktor), ((Y1 + SchiebY) * ZoomFaktor))-( _
((X2 + SchiebX) * ZoomFaktor), ((Y2 + SchiebY) * ZoomFaktor)), vbBlack
End If
picBox.DrawWidth = 1
End Sub Klasse cBuero:
Option Explicit
Const double_max = 1.79769313486231 * 10 ^ 308
Private WaendeCol As Collection
Private TischCol As Collection
Public Min_X As Double
Public Min_Y As Double
Public Max_Y As Double
Public Max_X As Double
Private Sub Class_Initialize()
Set WaendeCol = New Collection
Set TischCol = New Collection
Min_X = double_max
Min_Y = double_max
Max_Y = -(double_max)
Max_X = -(double_max)
End Sub
Public Sub Draw(picBox As PictureBox, ByVal ZoomFaktor As Double, ByVal SchiebX _
As Double, ByVal SchiebY As Double)
Dim Wand As cWand
Dim Tisch As cTisch
With frmmenu.PlanListbox(0)
// musst du ändern
If .Selected(0) Then
For Each Wand In WaendeCol
Wand.Draw picBox, ZoomFaktor, SchiebX, SchiebY
Next Wand
End If
If .Selected(1) Then
For Each Tisch In TischCol
Tisch.Draw picBox, ZoomFaktor, SchiebX, SchiebY
Next Tisch
End If
End With
End Sub
Public Function Add_Tisch(tId As Integer, corX1 As Double, corY1 As Double, _
corX2 As Double, corY2 As Double, iFillstyle As Integer) As cTisch
Dim NeuerTisch As cTisch
Set NeuerTisch = New cTisch
With NeuerTisch
.id = tId
.X1 = corX1
.Y1 = corY1
.X2 = corX2
.Y2 = corY2
.Fillstyle = iFillstyle
End With
TischCol.Add NeuerTisch
Set Add_Tisch = NeuerTisch
Set NeuerTisch = Nothing
End Function
Public Property Get Tisch(Index As Long) As cTisch
Set Tisch = TischCol(Index)
End Property
Public Property Get Tisch_Count() As Long
Tisch_Count = TischCol.Count
End Property |