CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
英特尔®游戏设计大赛100美元现金周周送 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  ATL/ActiveX/COM

MFC开发ATCIVEX 控件如何能用Dialog作为界面啊?

楼主klbs53(快乐悲伤)2003-02-04 15:07:42 在 VC/MFC / ATL/ActiveX/COM 提问

MFC开发ATCIVEX   控件如何能用Dialog作为界面啊 问题点数:0、回复次数:1Top

1 楼masterz(www.fruitfruit.com)回复于 2003-02-05 21:27:20 得分 0

http://www.codeguru.com/activex/dialogctrl.shtml  
  Dialog   frame   as   an   ActiveX   control  
   
  This   article   was   contributed   by   Petr   Stejskal.    
   
  I   wanted   to   create   a   control   which   would   behave   as   a   dialog   or   formview   (you   can   place   controls   here).   There   is   a   simple   way   to   do   it   -   to   take   advantage   of   ActiveX.    
   
  Create   a   new   MFC   ActiveX   ControlWizard   workspace   (no   need   to   special   options).    
  Insert   a   new   dialog   resource   named   IDC_MYDIALOG   (check   following:   style   -   child,   border   -   dialog   frame,   visible,   control,   static   edge)    
  Insert   a   new   MFC   class   named   CMyDialog   (base   class   CDialog)    
  Add   CMyDialog   m_MyDialog   member   to   your   CDialogCtrl   header   source   (don't   forget   to   add   #include   "MyDialog.h")    
  Using   classwizard   add   a   member   function   OnCreate   (WM_CREATE)    
  int   CDialogCtrl::OnCreate(LPCREATESTRUCT   lpCreateStruct)    
  {  
          if   (COleControl::OnCreate(lpCreateStruct)   ==   -1)  
                  return   -1;  
   
          m_MyDialog.Create(IDD_MYDIALOG,   this);  
          return   0;  
  }  
   
  Modify   the   member   function   OnDraw   (the   dialog's   size   depends   on   the   WIDTH   and   HEIGHT   specified   in   the   HTML   file):    
   
  void   CDialogCtrl::OnDraw(CDC*   pdc,   const   CRect&   rcBounds,   const   CRect&   rcInvalid)  
  {  
        //   TODO:   Replace   the   following   code   with   your   own   drawing   code.  
        //   pdc->FillRect(rcBounds,   CBrush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH)));  
        //   pdc->Ellipse(rcBounds);  
   
        m_MyDialog.MoveWindow(rcBounds,   TRUE);  
  }  
   
  To   show   the   control   in   your   browser   use   this   simple   HTML:    
   
      <html>  
      <head>  
      <title>DialogControl</title>  
      </head>  
      <body>  
       
      <center>  
      <OBJECT   ID="DialogControl"     CLASSID="CLSID:insert   here   the   GUID   from   ODL   file"  
        HEIGHT=300   WIDTH=300>  
      </OBJECT>  
      </center>  
       
      </body>  
      </html>  
   
  Last   updated:   17   November   1998    
   
  Top

相关问题

  • MFC:怎样使dialog上的控件对dialog透明
  • 在MFC中如何取得DIALOG中任一控件的ID值???
  • MFC DLL应用,Dialog中是不是不能包含ActiveX控件,标准控件显示正常,而加入ActiveX控件就无法显示。请教高手!
  • MFC制作DIALOG时,已经将窗体建成类,再向窗体上增加控件,还能将该控件设成类中变量吗?
  • 如何在MFC ActiveX控件中截获子控件的事件
  • MFC ActiveX控件的问题,很急
  • MFC ActiveX控件删除属性问题
  • 关于控件common dialog的问题
  • 如何将Dialog上的控件透明?
  • 关于dialog和combobox控件的问题

关键词

得分解答快速导航

  • 帖主:klbs53

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo