C++Builder 2010 CheckBox 自适应文本宽度

来源:互联网 发布:怎样做软件 编辑:程序博客网 时间:2024/06/05 05:56

C++Builder 2010 CheckBox 自适应文本宽度

void __fastcall TForm1::Button1Click(TObject *Sender){Graphics::TBitmap *bitmp = new Graphics::TBitmap;bitmp->Canvas->Font = CheckBox1->Font;int captionWidth = bitmp->Canvas->TextWidth(CheckBox1->Caption);CheckBox1->Width = captionWidth + 18;delete bitmp;}


0 0