在用MFC ActiveX ControlWizard创建ActiveX控件的过程中如何加入一个picture控件,以便在上面显示其它内容。初接触ActiveX,只大概理解框架
解决方案 »
- 【求助】connect达到一定值后导致进程重启,达人帮忙看看,多谢
- VC 无窗体应用程序的图标问题
- UDP内网服务器问题,高手速度进来
- VC用ADO连接远程数据库(在局域内)
- 有经验的朋友给个建议:用 C++ 作图像采集,选 BCB 还是 VC ?
- ado如何用集成windows验证的方式登陆sql server,期待您的help!!
- 用VC生成的EXE文件,在别的没有装VC的机器上就不能运行,可能要用到VC的一些资源吧,那如何才能生成可以不用那些资源的EXE文件呢!?
- 众为VC程序员,有空时来这发表一下对C#前途的看法!
- DirectSound流式Buffer一直想不通的问题
- 动态连接库的简单问题
- 请问零拷贝与pcap抓的网络数据有分别吗?是否都经过了协议栈?
- 求教:模拟资源管理器的VC++6.0程序代码?
然后在控件的control.cpp文件中加入对对话框的调用,这样控件的界面都能显示出来了
1、从CDialog类派生一个类CTestDlg以创建窗口,并添加picture窗体的控制类
CStatic mTestWindow;即
class CTestDlg : public CDialog
{
.... CStatic mTestWindow;
....
}2、接着在控件的control.cpp对CTestDlg调用,是不是把CTestDlb的一个实例作为
control的一个成员?如何调用不是很清楚?
谢谢指导
开始用下面的方法处理,但加入一个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);
}