DoubleLi

qq: 517712484 wx: ldbgliet

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

void CBtnDlg::OnOK()
{
 // TODO: Add extra validation here
 // 动态构建按钮代码
 CButton* pNewButton = new CButton();// 也可以定义为类的成员变量。
 CRect rcButton( 10, 10, 50, 30); // 按钮在对话框中的位置。
 pNewButton->Create("按钮", 0, rcButton, this, 10098);
 pNewButton->ShowWindow(SW_SHOW);
   
 //CDialog::OnOK();
}

LRESULT CBtnDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
 // TODO: Add your specialized code here and/or call the base class
 if ( WM_COMMAND== message )
 {
  WORD wID = LOWORD(wParam);
  if ( 10098 == wID)
  {
   CDC* pDC = GetDC();
   pDC->TextOut( 100, 100, "文字");
   ReleaseDC(pDC);
  }
    }
 return CDialog::DefWindowProc(message, wParam, lParam);
}

posted on 2012-11-27 21:02  DoubleLi  阅读(1859)  评论(0编辑  收藏  举报