Attribute VB_Name = "modInterfaceFunc" Option Explicit Function BuildGrid(Size_X As Long, Size_Y As Long, Squeeze As Boolean) Dim I As Long, _ IPiece As Long, _ x As Long, _ y As Long, _ CurX As Long, _ CurY As Long, _ Nombre_X As Long, _ Nombre_Y As Long Dim Espace As Integer Nombre_X = (Size_X * 2) + 1 Nombre_Y = (Size_Y * 2) + 1 CurX = 240 CurY = 240 x = 1 y = 1 If Squeeze = True Then Espace = 0 Else Espace = 120 End If IPiece = 1 ReDim TabPiece(1 To (((Size_X + 1) * Size_Y) + ((Size_Y + 1) * Size_X))) As Piece If Nombre_IMG > 1 Then For I = 2 To Nombre_IMG Unload sht_Game1.img_game(I) Next I End If For I = 1 To Nombre_X * Nombre_Y If I <> 1 Then Load sht_Game1.img_game(I) End If sht_Game1.img_game(I).Visible = True sht_Game1.img_game(I).BackColor = GameBackColor 'sht_Game1.img_game(I).Index = I sht_Game1.img_game(I).Top = CurY sht_Game1.img_game(I).Left = CurX If (EvenOdd(y)) = True Then sht_Game1.img_game(I).Height = 495 If EvenOdd(x) = True Then ' CENTRE : Zachsq.gif 'sht_Game1.img_game(I).Picture = LoadPicture(SMKIMAGEPATH + "transparent.gif") ' , vbLPLarge, vbLPColor) sht_Game1.img_game(I).Picture = sht_Game1.ImageList1.ListImages(4).Picture sht_Game1.img_game(I).Width = 495 CurX = CurX + 495 + Espace Else ' bluevertline.gif 'sht_Game1.img_game(I).Picture = LoadPicture(SMKIMAGEPATH + "transparent.gif") ' , vbLPLarge, vbLPColor) sht_Game1.img_game(I).Picture = sht_Game1.ImageList1.ListImages(4).Picture sht_Game1.img_game(I).Width = 135 CurX = CurX + 135 + Espace TabPiece(IPiece).Busy = False TabPiece(IPiece).Index = I IPiece = IPiece + 1 End If Else sht_Game1.img_game(I).Height = 135 If EvenOdd(x) = True Then ' bluehorizline.gif 'sht_Game1.img_game(I).Picture = LoadPicture(SMKIMAGEPATH + "transparent.gif") ' , vbLPLarge, vbLPColor) sht_Game1.img_game(I).Picture = sht_Game1.ImageList1.ListImages(4).Picture sht_Game1.img_game(I).Width = 495 CurX = CurX + 495 + Espace TabPiece(IPiece).Busy = False TabPiece(IPiece).Index = I IPiece = IPiece + 1 Else 'sht_Game1.img_game(I).Picture = LoadPicture(SMKIMAGEPATH + "Corner.gif") ' , vbLPLarge, vbLPColor) sht_Game1.img_game(I).Picture = sht_Game1.ImageList1.ListImages(1).Picture sht_Game1.img_game(I).Width = 135 CurX = CurX + 135 + Espace End If End If 'sht_Game1.img_game(I).ToolTipText = "I = " & I & ", X = " & x & ", Y = " & y x = x + 1 If x = (Nombre_X + 1) Then y = y + 1 x = 1 If y <> (Nombre_Y + 1) Then CurX = 240 End If If EvenOdd(y) = True Then CurY = CurY + 135 + Espace Else CurY = CurY + 495 + Espace End If End If Next I Nombre_IMG = (I - 1) sht_Game1.Width = CurX + 240 sht_Game1.Height = CurY + 240 + 645 + sht_Game1.SB1.Height CleanUpTabGrid End Function Public Sub CleanUpTabGrid() Dim I As Integer, _ J As Integer For J = 0 To 41 For I = 0 To 41 Tab_Grid(I).Ligne(J) = 0 Next I Next J End Sub Public Sub CalculPosition(Index As Integer, ByRef OutputPosition As Position) Dim v_position As Long, _ v_temp As Variant, _ v_width As Long, _ v_height As Long v_width = My_Width_X * 2 + 1 v_height = My_Height_Y * 2 + 1 'v_total = v_width * v_height v_temp = Round((Index / v_width), 6) v_position = InStr(v_temp, ",") If v_position = 0 Then OutputPosition.Ligne = v_temp - 1 OutputPosition.Col = v_width - 1 Else OutputPosition.Ligne = Mid(v_temp, 1, v_position) OutputPosition.Col = (v_width * (v_temp - OutputPosition.Ligne)) - 1 End If OutputPosition.Index = Index End Sub