J'ai fait cela en vitesse : tout est gégé dans le user control.
C'est faire à l'arrache (méthode apprise sur PA).
C'est peut être un début pour toi.
code du uc UserCOntrol1
CODE
dim x(1 to 4) as Integer
dim y(1 to 4) as integer
dim vlettre(1 to 4) as String
dim b as new Bitmap
dim b1 as new Bitmap
dim dessine as boolean
dim bouge as boolean
dim enCOurs as Integer
dim x0 as Integer
dim y0 as Integer
public property let lettre(byref l as String)
if encours <>0 and l <> vlettre(encours) then
vlettre(encours) = l
repaint
end if
End property
Private Sub UserControl_Load()
x(1) = 0
y(1) = 0
vlettre(1) = "A"
x(2) = width-13
y(2) = 0
vlettre(2) = "B"
x(3) = 0
y(3) = Height-13
vlettre(3) = "C"
x(4) = width-13
y(4) = height-13
vlettre(4) = "D"
b.create width,height
b1.create width,height
dessine = false
bouge = false
enCOurs = 0
End Sub
Private Sub UserControl_Paint()
b.CopyArea 0,0,width,Height,b1,0,0
dim i as Integer
b.BackColor = Htmlcolor("black")
b.TextColor = htmlColor("Red")
b.DrawFont = hbFontStandard
for i=1 to 4
b.Forecolor = b.BackColor
b.Rectangle x(i),y(i),x(i)+12,y(i)+12,hbRectBorderSolid+hbRectFillNone
b.backcolor = htmlColor("white")
b.TextOut x(i)+6,y(i)+6,vlettre(i),hbTextAlignCenter+hbTextAlignVCenter
b.BackColor = Htmlcolor("black")
if i=encours then
b.Rectangle x(i),y(i),x(i)+3,y(i)+3,hbRectFillSolid+hbRectBorderSolid,2
end if
next i
copyarea 0,0,Width,Height,b,0,0,hbDrawPaint
End Sub
Private Sub UserControl_PenDown(ByVal xp As Integer, ByVal yp As Integer)
encours = 0
bouge = false
dessine = false
dim i as Integer
if xp<0 or yp<0 or xp>Width or yp>Height then exit sub
for i=1 to 4
if x(i) < xp and y(i) yp then
encours = i
bouge = true
end if
next i
if not bouge then
dessine = true
x0 = xp
y0 = yp
end if
repaint
End Sub
Private Sub UserControl_PenMove(ByVal xp As Integer, ByVal yp As Integer)
if xp<0 or yp<0 or xp>Width or yp>Height then exit sub
if bouge then
x(encours) = xp
y(encours) = yp
end if
if dessine then
b.Forecolor = b.BackColor
b1.Line x0,y0,xp,yp
x0 = xp
y0 = yp
end if
repaint
End Sub
Private Sub UserControl_PenUp(ByVal x As Integer, ByVal y As Integer)
UserControl_PenMove x ,y
bouge = false
dessine = false
End Sub
Dans ma fenetre j'ai mis un user control : UserControl11, mettre un truc assez grand.
Et le code de la fenetre :
CODE
Private Sub Form_KeyPress(ByRef iChar As Integer, ByRef iKeyCode As Integer, ByRef eModifiers As HbKeyModifier, ByRef bForward As Boolean)
if iChar >= asc("A") and iChar <= asc("I") or iChar >= asc("a") and iChar <= asc("i") then
UserControl11.lettre = chr(iChar)
end if
End Sub
On peut changer la lettre du carré en ecrivant dans la zone graphitti.
On peut dessiner dans le user control
On peut déplacer les joueurs (carrés) en les sélectionnant et en faisant glisser le stylet.
Si ca t'aide, tant mieux.