Je traduit une fonction Delphi utilisant l'API " TabbedTextOut " et j'ai un probleme avec la chaine de caracteres a passer a la fonction
le code Delphi
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
 
var
 XCols: array[1..4] of integer;
 S: string;
 I, y, H: integer;
begin
 XCols[1] := 0;
 XCols[2] := round(image1.Width / 4);
 XCols[3] := round(image1.Width / 2);
 XCols[4] := image1.Width - XCols[2];
 y := 0;
 H := Image1.Canvas.TextHeight('M'); {la plus haute}
 for i := 0 to 5 do
  begin
   S := format('L%dC0'#9'L%dC1'#9'L%dC2'#9'L%dC3', [I, I, I, I]);
   TabbedTextOut(image1.Canvas.handle, 0, y, PChar(S), length(S), 4, XCols[1], 0);
   Y := Y + H + 2;
  end;
Ce que je pense avoir traduit correctement
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
 
int XCols[4];
String S;
int I, Y, H;
 XCols[1] = 0;
 XCols[2] = int(Image1->Width / 4);
 XCols[3] = int(Image1->Width / 2);
 XCols[4] = Image1->Width - XCols[2];
Y = 0;
H = Image1->Canvas->TextHeight("M");
for (I = 0; I <+5; I++)
{
S = Format("L%dC0\tL%dC1\tL%dC2\tL%dC3", [I, I, I, I]);
TabbedTextOut(Image1->Canvas->Handle, 0, Y, S.c_str(), S.Length(), 4, XCols[1], 0);
Y = Y + H + 2;
}
C'est cette ligne qui me pose probleme
S = Format("L%dC0\tL%dC1\tL%dC2\tL%dC3", [I, I, I, I]);
Je devrais recuperer un tableau du genre
L0C0 L0C1 L0C2 L0C3
L1C0 L1C1 L1C2 L0C3