Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a (tournament) draw of a form 1

Status
Not open for further replies.

sfenx

Programmer
Feb 23, 2001
81
BE
I want to create a draw for a tournament on a form.
For example : when there are 8 entries, the tournament begins with the quarter finals, so I begin with 4 matches (8 players) in the 1ste collumn, 2 matches (semi finals : 4 players) in the second collumn and 1 match (2 players) in the 3rd collumn (final).
What is the best way to put the data (of the database) on the form and let the program respond by clicking on a specific field (player) ie. to give its personal data ?
Graphically I would like also to draw a line from the game (between 2 players) to the winner (who also is connected with a line to an other player)
I hope my explanations are clear. :)
I think of using the data in an array but still don't know how I can get the object positionned.
(I saw this working in an old game named Tennis Elbow, and this is exactly what I want to do)

Any suggestions would be great ! s-)
 
Form AutoDraw = True then (is meer een voorbeeld)

Private Sub Form_Click()
Dim players As Integer
Dim stuff As Integer
Dim round As Integer
Dim left, right As Integer
Dim height As Integer
Dim count1 As Integer
Dim X As Boolean

stuff = 840
left = 480
left1 = Screen.Width - 2160
right = 2160
right1 = Screen.Width - 480
round = 1
count1 = 1
players = InputBox("Enter # of players", "# of players")
If players < 11 Then
Do
For i = 1 To players
Line (left, stuff%)-(right, stuff%), vbWhite
'label displaying
Load Label1(count1)
Label1(count1).left = left + 50
Label1(count1).Width = right - left
Label1(count1).Top = stuff - 200
Label1(count1).Visible = True
'end of label displaying and count increment
Select Case round
Case 1
height = stuff
stuff = stuff + 480
Label1(count1).Caption = &quot;player &quot; & i
Case 2
height = stuff
stuff = stuff + 950
Label1(count1).Caption = &quot;round 2 contestant&quot;
Case 3
height = stuff
stuff = stuff + 1950
Label1(count1).Caption = &quot;round 3 contestant&quot;
Case 4
height = stuff
stuff = stuff + 4000
Label1(count1).Caption = &quot;round 4 contestant&quot;
End Select

count1 = count1 + 1
X = i Mod 2

If X = True Then
Line (right, stuff%)-(right, height), vbWhite
End If

Next i
round = round + 1
left = right
right = right + 1680
players = players / 2
Select Case round
Case 2
stuff = 1080
height = 1080
Case 3
stuff = 1500
height = 1500
Case 4
stuff = 2500
height = 2500
End Select

Loop Until players = 1
Else
''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''For 2 sided Brackets. More then 10 Users'''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''
Do
For i = 1 To players / 2
Line (left, stuff%)-(right, stuff%), vbWhite
Line (left1, stuff%)-(right1, stuff%), vbWhite
'label displaying
'left labels
Load Label1(count1)
Label1(count1).left = left + 50
Label1(count1).Width = right - left
Label1(count1).Top = stuff - 200
Label1(count1).Visible = True
'right labels
Load Label1(count1 + 1)
Label1(count1 + 1).left = left1 + 50
Label1(count1 + 1).Width = right - left
Label1(count1 + 1).Top = stuff - 200
Label1(count1 + 1).Visible = True
'end of label displaying and count increment
Select Case round
Case 1
height = stuff
stuff = stuff + 480
Label1(count1).Caption = &quot;player &quot; & count1
Label1(count1 + 1).Caption = &quot;player &quot; & count1 + 1
Case 2
height = stuff
stuff = stuff + 950
Label1(count1).Caption = &quot;round 2 contestant&quot;
Label1(count1 + 1).Caption = &quot;round 2 contestant&quot;
Case 3
height = stuff
stuff = stuff + 1950
Label1(count1).Caption = &quot;round 3 contestant&quot;
Label1(count1 + 1).Caption = &quot;round 3 contestant&quot;
Case 4
height = stuff
stuff = stuff + 4000
Label1(count1).Caption = &quot;round 4 contestant&quot;
Label1(count1 + 1).Caption = &quot;round 4 contestant&quot;
End Select

count1 = count1 + 2
X = i Mod 2

If X = True Then
Line (right, stuff%)-(right, height), vbWhite
Line (left1, stuff%)-(left1, height), vbWhite
End If

Next i
round = round + 1
're alignment
left = right
right1 = left1
right = right + 1680
left1 = left1 - 1680
players = players / 2
Select Case round
Case 2
stuff = 1080
height = 1080
Case 3
stuff = 1500
height = 1500
Case 4
stuff = 2500
height = 2500
End Select

Loop Until players = 1

End If

End Sub
Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top