我正在尝试在动态创建的TLabel
对象中设置字体颜色和字体大小,但它不起作用。
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TLabel *text;
text = new TLabel(Form1);
text->Parent = Form1;
text->Align = TAlignLayout::Center;
text->Margins->Top = 60;
text->Font->Size = 13; // don't works
text->FontColor = TColorRec::Red; // don't works
text->Height = 17;
text->Width = 120;
text->TextSettings->HorzAlign = TTextAlign::Center;
text->TextSettings->VertAlign = TTextAlign::Leading;
text->StyledSettings.Contains(TStyledSetting::Family);
text->StyledSettings.Contains(TStyledSetting::Style);
text->Text = "My Text";
text->VertTextAlign = TTextAlign::Leading;
text->Trimming = TTextTrimming::None;
text->TabStop = false;
text->SetFocus();
}
结果: