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

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;
}


猜你喜欢

转载自blog.csdn.net/tajon1226/article/details/70407628
今日推荐