如何在MFC中更改文本控件的大小 [英] How to change the size of the text control in mfc
问题描述
大家好,
我已经创建了一个基于对话框的应用程序.我已经采用了文本控件,我需要更改其大小以适应特定要求的文本控件容纳更多文本,但是需要通过代码来实现,而不仅仅是简单地对其进行拉伸.
我想在调用InitDialog()时更改其大小,但是我没有得到那段代码.
IDC_STATIC是文本控件的控件ID.
我想做这样的事情
GetDlgItem(IDC_STATIC)-> SetRectangleSize(矩形的坐标)
请为我提供解决方案的正确版本.
hi all ,
I have created a dialog based application .I have taken a text control which I need to change for its size to accommodate more text for that text control for some specific requirement but need to do it through code not by simply stretching it .
I thought to change its size when InitDialog() is called but I am not getting that piece of code to that .
IDC_STATIC is the control Id of text control .
I want to do something like that
GetDlgItem(IDC_STATIC)->SetRectangleSize(co-ordinates for the rectangle)
Kindly provide me correct version of the solution .
推荐答案
使用 ^ ]函数在运行时更改控件的尺寸.
Use the CWnd::SetWindowPos[^] function to change the dimension of the control at run-time.
将ID更改为IDC_STATIC_1或使其独特的东西和代码
Change id to IDC_STATIC_1 or something that makes it unique and the code
GetDlgItem(IDC_STATIC_1)->SetRectangleSize(co-ordinates for the rectangle);
应该做你想要的
我显示的示例着重介绍对话框项ID,而不是完成工作所需的实际方法.
should do what you are looking for
The example I have shown stresses on the dialog item id and not the actual method you need to get your job done.
您可以在MSDN中看到HWND :: movewindow API
you can see HWND::movewindow API in MSDN
这篇关于如何在MFC中更改文本控件的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!