Bonjour, j'utilise une police de caractère pour un jeu de dames et je voudrais le faire évoluer vers un graphisme plus sympa.
La police rempli un Tstringgrid ici BoardGrid.
Est qu'il est possible de faire une routine qui balaie le TStringGrid et affiche les pions en fonction du contenu de celui-ci ?

voici le code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
void __fastcall TMainForm::BoardGridDragDrop(TObject *Sender,
      TObject *Source, int X, int Y)
{
	int icol, irow;
  int ilist;
  int n, jlist;
  char move[LINE_MAX];
  int lmove;
 
	BoardGrid->MouseToCell(X, Y, icol, irow);
  if (InvertBoard)
	  DragTo = DragDropMap[9 - icol][9 - irow];
  else
	  DragTo = DragDropMap[icol][irow];
	if ((DragFrom != 0) and (DragTo != 0))
  {
    sprintf(move, "%d/%d", DragFrom, DragTo);
    lmove = strlen(move);
    n = 0;
		for (ilist = 0; ilist < MovesList->Items->Count; ilist++)
  	{
    	if (strncmp(move, DragDropMovesList->Strings[ilist].c_str(), lmove) == 0)
      {
      	n++;
        jlist = ilist;
      }
    }
    if (n != 1)
    {
      n = 0;
      for (ilist = 0; ilist < MovesList->Items->Count; ilist++)
      {
	    	if (strcmp(move, DragDropMovesList->Strings[ilist].c_str()) == 0)
       	{
          n++;
          jlist = ilist;
        }
      }
    }
    if (n == 1)
    {
    	MovesList->ItemIndex = jlist;
    	MovesListClick(NULL);
  	}
		else
    {
    	my_printf("le coup %s est illégal!\n", move);
    }
  }
}