mfc group box控件的属性Horizontal Alignment如何动态修改?

woquNOKIA 2017-01-08 11:35:04
见标题。
最好说明一下如何查找控件的属性,如何查找修改其属性的方法。
...全文
238 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
schlafenhamster 2017-01-09
  • 打赏
  • 举报
回复
",7,7,194,77,是x,y,cx,cy。他和控件的大小什么区别呀?" 在资源文件中,这是 对话框 单位, 不是 pixel 单位。 GetDialogBaseUnits The GetDialogBaseUnits function returns the system's dialog base units, which are the average width and height of characters in the system font. For dialog boxes that use the system font, you can use these values to convert between dialog template units, as specified in dialog box templates, and pixels. For dialog boxes that do not use the system font, the conversion from dialog template units to pixels depends on the font used by the dialog box. For either type of dialog box, it is easier to use the MapDialogRect function to perform the conversion. MapDialogRect takes the font into account and correctly converts a rectangle from dialog template units into pixels. LONG GetDialogBaseUnits(VOID) Parameters This function has no parameters. Return Values The return value is a 32-bit value that contains the dialog base units. The low-order word of the return value contains the horizontal dialog box base unit, and the high-order word contains the vertical dialog box base unit.
woquNOKIA 2017-01-09
  • 打赏
  • 举报
回复
引用 5 楼 schlafenhamster 的回复:
“”截图是静直接修改属性“” 检查 资源文件里 这个属性的 名。如: GROUPBOX "GroupBox",IDC_GROUP,7,7,194,77,BS_BITMAP | BS_CENTER | BS_NOTIFY BS_CENTER 然后 程序可以 调用 ModifyStyle()
谢谢,allMeg->ModifyStyle(0,BS_CENTER); //好用 我的不好用,是因为我的dialog是自己继承的office2007风格的dialog,调用了继承的dialog:OnInitDialog ();就不起作用了。 ,7,7,194,77,是(*.rc)x,y,cx,cy。他和控件的大小什么区别呀?例如 CRect rectTemp; GetDlgItem(IDC_STATIC_test)->GetWindowRect(rectTemp);
赵4老师 2017-01-09
  • 打赏
  • 举报
回复
就算控件的属性要求不能动态修改,你也可以用大小和位置完全相同的两个动态控件交替显示来模拟对应属性被“动态修改”。
Eleven 2017-01-09
  • 打赏
  • 举报
回复
引用 6 楼 woquNOKIA 的回复:
[quote=引用 楼主 woquNOKIA 的回复:] 见标题。 最好说明一下如何查找控件的属性,如何查找修改其属性的方法。
SetWindowPos只能修改它的位置和大小,没修改变标题的位置的选项呀!![/quote] GetDlgItem(IDC_STATIC_GROUP)->ModifyStyle(BS_LEFT, BS_RIGHT);
woquNOKIA 2017-01-09
  • 打赏
  • 举报
回复
引用 5 楼 schlafenhamster 的回复:
“”截图是静直接修改属性“” 检查 资源文件里 这个属性的 名。如: GROUPBOX "GroupBox",IDC_GROUP,7,7,194,77,BS_BITMAP | BS_CENTER | BS_NOTIFY BS_CENTER 然后 程序可以 调用 ModifyStyle()
谢谢,allMeg->ModifyStyle(0,BS_CENTER); //不好使啊 ,7,7,194,77,是x,y,cx,cy。他和控件的大小什么区别呀?例如 CRect rectTemp; GetDlgItem(IDC_STATIC_test)->GetWindowRect(rectTemp); 不一样大啊!
woquNOKIA 2017-01-09
  • 打赏
  • 举报
回复
引用 1 楼 hdt 的回复:
试试调用 SetWindowPos api
SetWindowPos只能修改它的位置和大小,没修改变标题的位置的选项呀!!
woquNOKIA 2017-01-09
  • 打赏
  • 举报
回复
引用 楼主 woquNOKIA 的回复:
见标题。 最好说明一下如何查找控件的属性,如何查找修改其属性的方法。
SetWindowPos只能修改它的位置和大小,没修改变标题的位置的选项呀!!
woquNOKIA 2017-01-08
  • 打赏
  • 举报
回复
真相重于对错 2017-01-08
  • 打赏
  • 举报
回复
试试调用 SetWindowPos api
schlafenhamster 2017-01-08
  • 打赏
  • 举报
回复
“”截图是静直接修改属性“” 检查 资源文件里 这个属性的 名。如: GROUPBOX "GroupBox",IDC_GROUP,7,7,194,77,BS_BITMAP | BS_CENTER | BS_NOTIFY BS_CENTER 然后 程序可以 调用 ModifyStyle()
真相重于对错 2017-01-08
  • 打赏
  • 举报
回复
引用 3 楼 woquNOKIA 的回复:
截图是静直接修改属性,如何改成动态的。
既然用mfc,你就要了解一下win api编程
woquNOKIA 2017-01-08
  • 打赏
  • 举报
回复
截图是静直接修改属性,如何改成动态的。

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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