在用MFC ActiveX ControlWizard创建ActiveX控件的过程中如何加入一个picture控件,以便在上面显示其它内容。初接触ActiveX,只大概理解框架

解决方案 »

  1.   

    你要先建立一个对话框,使其该对话框成为你控件的界面,在此对话框中设计控件界面。这样你就能加入picture控件了!
    然后在控件的control.cpp文件中加入对对话框的调用,这样控件的界面都能显示出来了
      

  2.   

    在控件创建时创建一个Picture控件就可以.
      

  3.   

    按你指导,是不是这样的过程呢?
    1、从CDialog类派生一个类CTestDlg以创建窗口,并添加picture窗体的控制类
       CStatic mTestWindow;即
       
       class CTestDlg : public CDialog
      {
       ....    CStatic mTestWindow;
         ....
      }2、接着在控件的control.cpp对CTestDlg调用,是不是把CTestDlb的一个实例作为
       control的一个成员?如何调用不是很清楚?
       
    谢谢指导
      

  4.   

    大家帮看看啊这里的picture作为一个视频窗口,我想只要在控件的外观处实现了picture,再让其作为视频窗口不会多难。
    开始用下面的方法处理,但加入一个dialog, 我就想控件外观仅是一个picture.开始按下面的方法处理
    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);
    }