头文件声明
.cpp文件按钮设置
int CMFCApplication2View::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: 在此添加您专用的创建代码
CRect rect_button(40, 10, 200, 60), rect1(250, 20, 330, 50), rect2(360, 20, 440, 50),
rect3(700, 10, 860, 60), rect4(950, 10, 1100, 60);
btn1.Create(_T("矩形"), WS_CHILD | WS_VISIBLE | WS_BORDER, rect_button, this, 130);
btn2.Create(_T("→"), WS_CHILD | WS_VISIBLE | WS_BORDER, rect1, this, 140);
btn3.Create(_T("←"), WS_CHILD | WS_VISIBLE | WS_BORDER, rect2, this, 150);
btn4.Create(_T("旋转"), WS_CHILD | WS_VISIBLE | WS_BORDER, rect3, this, 160);
btn5.Create(_T("复原"), WS_CHILD | WS_VISIBLE | WS_BORDER, rect4, this, 170);
return 0;
}
结果按钮上的文本不显示