Option Explicit Private Sub Form_Activate() Dim nbcol As Integer, nblignes As Integer, coefx As Single, coefy As Single Dim epaistrait As Integer, epaisbord As Integer, coultrait As Long, coulbord As Long Dim i As Integer, nbcases As Integer nbcol = 9 nbcases = 81 coefx = 0.7 coefy = 0.3 epaistrait = 2 epaisbord = 12 coultrait = RGB(255, 100, 100) coulbord = RGB(100, 100, 255) Text1(0).Text = "" fairetableau Me, Picture1, nbcol, nbcases, coefx, coefy, epaistrait, epaisbord, _ coultrait, coulbord End Sub Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) Select Case KeyCode Case 40 If Index <71 Then Text1(Index + 9).SetFocus Else KeyCode 0 Case 38 If Index >9 Then Text1(Index - 9).SetFocus Else KeyCode 0 Case 39 If Index <79 Then Text1(Index + 1).SetFocus Else KeyCode 0 Case 37 If Index >1 Then Text1(Index - 1).SetFocus Else KeyCode 0 Case 33 Text1(Index Mod 9).SetFocus Case 34 Text1(72 + Index Mod 9).SetFocus Case 36 Text1(0).SetFocus Case 35 Text1(80).SetFocus End Select End Sub
Option Explicit Public Sub fairetableau(jmf As Form, pct As PictureBox, ncl As Integer, nbc As Integer, _ kx As Single, ky As Single, ltr As Integer, lbd As Integer, cltr As Long, cbd As Long) Dim haut As Integer, larg As Integer, corrx As Single Dim corry As Single, i As Integer, j As Integer, nlg As Integer pct.AutoRedraw = True pct.BorderStyle = 0 nbc = nbc - 1 If (nbc + 1) Mod ncl = 0 Then nlg = nbc / ncl Else nlg = Int((nbc + 1) / ncl) + 1 End If haut = Int(pct.Height / nlg) * ky larg = Int(pct.Width / ncl) * kx corrx = (Int(pct.Width / ncl) - larg) / 2 corry = (Int(pct.Height / nlg) - haut) / 2 Dim nb As Integer For i = 1 To nbc Load jmf.Text1(i) jmf.Text1(i).Visible = True Next nb = 0 For i = 0 To pct.Width Step Int(pct.Width / ncl) pct.DrawWidth = ltr pct.ForeColor = cltr If nb > 0 Then pct.Line (i + pct.DrawWidth, 0)-(i + pct.DrawWidth, pct.Height) On Error Resume Next For j = 0 To ncl + nlg jmf.Text1(nb + (j * ncl)).Move i + corrx, jmf.Text1(nb + (j * ncl)).Top, larg, haut * ky Next j nb = nb + 1 If nb >= ncl Then Exit For Next nb = 0 For i = 0 To pct.Height Step Int(pct.Height / nlg) If nb > 0 Then pct.Line (0, i)-(pct.Width, i) On Error Resume Next For j = 0 To ncl + nlg jmf.Text1(nb * ncl + j).Top = i + corry Next j nb = nb + 1 If nb >= nlg Then Exit For Next jmf.DrawWidth = lbd jmf.ForeColor = cbd Dim tt As Single tt = jmf.DrawWidth * Screen.TwipsPerPixelX / 2 jmf.Line (pct.Left - tt, pct.Top - tt)-(pct.Left + pct.Width + tt, pct.Top + pct.Height + tt), , B End Sub
Le problème c'est que j'ai besoin de saisir dans la zone de texte mes chiffres de sudoku.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub box_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
type définit par l'utilisateur non-défini.
box(i+1)
Private Sub box_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 39 Then i = i + 1 if i > 3 then i = 1 ' home de ta ligne ' OU (l'un ou l'autre) exit sub ' refus d'avancer end if box(i).SetFocus end if
Oui, c'est du vb6 (SetFocus = vb6)
As MSForms.ReturnIntegerait été dénoncé , mais également (me relire) du fait de
box(i+1)(entre autres). Me relire.