我再VC里面假如有10个BUTTON,我要在代码里面实现对这些BUTTON固定位置,设置字体等等,现在我用的方法是一个个的设置,能否把这些BUTTON添加到一个数组里面,然后进行一个循环,我觉得这样比较简单,我现在的方法比较笨,还请高手指点应该怎么做?CButton m_btnStrips_print;
CButton m_btnStrips_confirm;
CButton m_btnPageup;
CButton m_btnPagedown;
CButton m_btnNormal;
CButton m_btnClassify_VE;
CButton m_btnClassify_SVE;
CButton m_btnClassify_artifact;
CButton m_chTwo;
CButton m_chThree;
CButton m_chOne;
CButton m_chAll;
CButton m_btn56;
CButton m_btn48;
CButton m_btn42;
CButton m_btn36;
CButton m_btn32;
CButton m_btn28;
CButton m_btn24;
CButton m_btn180;
CButton m_btnMax;
我写了一个方法对所有的BUTTON设置字体:
void CCBUIView::ButtonStyle()
{
//设置BUTTON的字体
CFont m_newFont;
m_newFont.CreatePointFont(90,"Arial",NULL);
m_btnArtifact.SetFont(&m_newFont,TRUE);
m_btnBigmini.SetFont(&m_newFont,TRUE);
m_btnBrady.SetFont(&m_newFont,TRUE);
m_btnMinimum.SetFont(&m_newFont,TRUE);
m_btnPair.SetFont(&m_newFont,TRUE);
m_btnPause.SetFont(&m_newFont,TRUE);
m_btnPVC.SetFont(&m_newFont,TRUE);
m_btnSVE.SetFont(&m_newFont,TRUE);
m_btnSVEBigmini.SetFont(&m_newFont,TRUE);
m_btnMax.SetFont(&m_newFont,TRUE); m_btn180.SetFont(&m_newFont,TRUE);
m_btn24.SetFont(&m_newFont,TRUE);
m_btn28.SetFont(&m_newFont,TRUE);
m_btn32.SetFont(&m_newFont,TRUE);
m_btn36.SetFont(&m_newFont,TRUE);
m_btn42.SetFont(&m_newFont,TRUE);
m_btn48.SetFont(&m_newFont,TRUE);
m_btn56.SetFont(&m_newFont,TRUE);
m_btnClassify_artifact.SetFont(&m_newFont,TRUE);
m_btnClassify_SVE.SetFont(&m_newFont,TRUE);
m_btnClassify_VE.SetFont(&m_newFont,TRUE);
m_btnNormal.SetFont(&m_newFont,TRUE);
m_btnPagedown.SetFont(&m_newFont,TRUE);
m_btnPageup.SetFont(&m_newFont,TRUE);
m_btnStrips_confirm.SetFont(&m_newFont,TRUE);
m_btnStrips_print.SetFont(&m_newFont,TRUE);
m_chAll.SetFont(&m_newFont,TRUE);
m_chOne.SetFont(&m_newFont,TRUE);
m_chTwo.SetFont(&m_newFont,TRUE);
m_chThree.SetFont(&m_newFont,TRUE);
}
可是我觉得这样太笨了,有简单的方法吗?
CButton m_btnStrips_confirm;
CButton m_btnPageup;
CButton m_btnPagedown;
CButton m_btnNormal;
CButton m_btnClassify_VE;
CButton m_btnClassify_SVE;
CButton m_btnClassify_artifact;
CButton m_chTwo;
CButton m_chThree;
CButton m_chOne;
CButton m_chAll;
CButton m_btn56;
CButton m_btn48;
CButton m_btn42;
CButton m_btn36;
CButton m_btn32;
CButton m_btn28;
CButton m_btn24;
CButton m_btn180;
CButton m_btnMax;
我写了一个方法对所有的BUTTON设置字体:
void CCBUIView::ButtonStyle()
{
//设置BUTTON的字体
CFont m_newFont;
m_newFont.CreatePointFont(90,"Arial",NULL);
m_btnArtifact.SetFont(&m_newFont,TRUE);
m_btnBigmini.SetFont(&m_newFont,TRUE);
m_btnBrady.SetFont(&m_newFont,TRUE);
m_btnMinimum.SetFont(&m_newFont,TRUE);
m_btnPair.SetFont(&m_newFont,TRUE);
m_btnPause.SetFont(&m_newFont,TRUE);
m_btnPVC.SetFont(&m_newFont,TRUE);
m_btnSVE.SetFont(&m_newFont,TRUE);
m_btnSVEBigmini.SetFont(&m_newFont,TRUE);
m_btnMax.SetFont(&m_newFont,TRUE); m_btn180.SetFont(&m_newFont,TRUE);
m_btn24.SetFont(&m_newFont,TRUE);
m_btn28.SetFont(&m_newFont,TRUE);
m_btn32.SetFont(&m_newFont,TRUE);
m_btn36.SetFont(&m_newFont,TRUE);
m_btn42.SetFont(&m_newFont,TRUE);
m_btn48.SetFont(&m_newFont,TRUE);
m_btn56.SetFont(&m_newFont,TRUE);
m_btnClassify_artifact.SetFont(&m_newFont,TRUE);
m_btnClassify_SVE.SetFont(&m_newFont,TRUE);
m_btnClassify_VE.SetFont(&m_newFont,TRUE);
m_btnNormal.SetFont(&m_newFont,TRUE);
m_btnPagedown.SetFont(&m_newFont,TRUE);
m_btnPageup.SetFont(&m_newFont,TRUE);
m_btnStrips_confirm.SetFont(&m_newFont,TRUE);
m_btnStrips_print.SetFont(&m_newFont,TRUE);
m_chAll.SetFont(&m_newFont,TRUE);
m_chOne.SetFont(&m_newFont,TRUE);
m_chTwo.SetFont(&m_newFont,TRUE);
m_chThree.SetFont(&m_newFont,TRUE);
}
可是我觉得这样太笨了,有简单的方法吗?
解决方案 »
- 前向差分矩阵的转置是后向差分矩阵?
- CListCtrl 怎样改变单行的文本颜色
- 实验课 快速排序(实在不懂谁能帮下忙)
- 如何建立基类是CADORecordBinding的类
- 请问:这两行代码是什么意思?
- ★★最近在网上看到用以下代码来连接数据库,但连接后又如何操作数据库呢?如读,写等.....
- 大家好啊,我想问一个菜鸟的问题!
- 请问各位虾哥虾妹,谁用过tase.2规约(电力行业通信规约),如用过,请留下E—MAIL。1000 分相送
- 请问如何读写mp3文件的IDv1和IDv2标签?
- 有没有功能强大的WINSOCK数据包截取、截获分析工具
- mac地址判断唯一机子的疑惑
- 连服务器读数据,服务器内存泄露???高手帮忙
&m_btnMax};for ( int i = 0; i < sizeof(pBtnArray) / sizeof( pBtnArray[0] ); i++ )
{
(pBtnArray[i])->SetFont(&m_newFont,TRUE); }
{
CButton* pButton=(CButton*)GetDlgItem(IDC_BUTTON1+i);
pButton->SetFont;
}