Schrift einer StringGrid-Spalte ändern
-
Hallo,
wie kann man einer Spalte einer StringGrid eine andere Schrift zuweisen. Habe in DrawCells folgendes versucht, was aber gemein flackert.Freue mich auf Hinweise.
Gruß Egbert[code]
...
...StringGrid1->Canvas->FillRect(Rect);
int hAlign;
// Spalten-Abfrage
if (UpperCase(StringGrid1->Cells[ACol][1]) == "M1" ||
UpperCase(StringGrid1->Cells[ACol][1]) == "M2" ||
UpperCase(StringGrid1->Cells[ACol][1]) == "E1" ||
StringGrid1->Cells[ACol][1] == '*')
{
Rect.Right = Rect.Right-5;
hAlign = 2; //rechtsbdg.
StringGrid1->Font->Height=20; // Schriftgr.größer
}
else
{
Rect.Left = Rect.Left+5;
hAlign = 0;
StringGrid1->Font->Height=10; // Schriftgr.wieder kleiner
}DrawText(StringGrid1->Canvas->Handle, StringGrid1->Cells[ACol][ARow].c_str(),
-1, &Rect, DT_SINGLELINE | DT_VCENTER | hAlign);
}
-
Hallo
Du darfst nicht StringGrid1->Font ändern, das ruft sofort einen neuen Draw-Event für das StringGrid1 auf.
Übergib den Font und Größe an StringGrid1->Canvas->Fontbis bald
akari
-
Hallo,
Danke für prompte Antwort. Habe es sofort ausprobiert und klappt, wie gewünscht.
Gruß und nochmal Danke! Egbert