C++ Builder窗体自定义消息框,替换自带ShowMessage对话框,解决ShowMessage字体小不够大的问题。自适应长文本消息、多行文本消息。
https://download.csdn.net/download/u010165006/11576727
没积分的,留伊妹儿发。
核心代码:
object Button1: TButton
Anchors = [akBottom]
Caption = '确定'
ModalResult = 1
TabOrder = 0
end
//---------------------------------------------------------------------------
void __fastcall TfrmMsg::show(AnsiString msg,int fontSize/*=12*/)
{
this->Caption=Application->Title;
Label1->Caption=msg;
Label1->Font->Size=fontSize;
this->ClientWidth=Label1->Width+40;
this->ClientHeight=Label1->Height+80;
this->Position=poScreenCenter;
this->ShowModal();
}
//---------------------------------------------------------------------------
只有一个问题不好解决,我看ShowMessage显示多行中文的时候,行与行之间是有一定间隔的,不知道是怎么实现的?
Label1如果用宋体,多行文本之间是几乎没有间隔的,只发现微软雅黑字体多行之间有一定间隔,但是字体偏黑了。