1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| void __fastcall TForm1::StringGrid1KeyPress(TObject *Sender, char &Key)
{
if(MaCol==1){ int lh2;
int taille=StringGrid1->ColWidths[1]-15;
if(Key == VK_RETURN){
if(StringGrid1->Row>=StringGrid1->RowCount-1){return;}
lh2=taille;StringGrid1->Row++;}
AnsiString TT= Form1->StringGrid1->Cells[1][StringGrid1->Row];
lh2=StringGrid1->Canvas->TextWidth(TT);
if(lh2>=taille){
StringGrid1->Row=StringGrid1->Row+1; }
//***********************************************
AnsiString T= Form1->StringGrid1->Cells[1][StringGrid1->Row];
int i=T.Length();
if(Key == VK_BACK)
{i=i-1;
if(StringGrid1->Row<=0){return;}
if(i<0){ StringGrid1->Row=StringGrid1->Row-1;
}}}
} |
Partager