如何让Memo组件自动调整大小

fosterxujp 2006-06-03 09:14:26
如果memo里面有一行字符,就自动设置其高度为一行高
如果memo里面有N行字符,就自动设置其高度为N行高

如何实现以上功能呢,谢谢
...全文
233 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
天地任逍遥 2006-07-09
  • 打赏
  • 举报
回复
请教一下各位:请问如果在Memo1中有这样的一组数据:
12 36 45 65
78 98 78 45
45 78 87 95
42 65 78 62
因为输入进去的是字符串 我要得到上面的一个一个的整型数据 应该怎么做呢?
因为是刚刚开始看C++Builder 所以还不是很明白 帮我解决一下了 非常感谢了
BlueDeepOcean 2006-06-07
  • 打赏
  • 举报
回复
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Memo1->Height = (Memo1->Font->Size - Memo1->Font->Height) * Memo1->Lines->Count;
}
daydayup234 2006-06-03
  • 打赏
  • 举报
回复
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int lineCount,fontH;
lineCount=Memo1->Lines->Count;
//fontSize=Memo1->Font->Size;//Size:Specifies the height of the font in points.
fontH=Memo1->Font->Height;//Height:Use Height to specify the height of the font in pixels.
Memo1->Height=-lineCount*fontH; //Height:Specifies the vertical size of the control in pixels.
}

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧