0

我有一个基于 MFC 的 ActiveX 控件,其中一些重要的东西不起作用。永远不会调用大小事件,并且仅当我单击控件的边框(在 ActiveX 测试容器中)时才会重绘控件内容。

这是我在头文件中的 size-event 代码:

public:
    afx_msg void OnPaint();

...在源文件中:

BEGIN_MESSAGE_MAP(CBeamConstruXCtrl, COleControl)
    ON_WM_SIZE()
    ON_WM_PAINT()
    ON_OLEVERB(AFX_IDS_VERB_PROPERTIES, OnProperties)
END_MESSAGE_MAP()

void MyCtrl::OnPaint()
{
   //this is never called also when I change the size of the control in test container
}

任何想法这里缺少什么?

编辑:只是澄清一下: OnSize() 在 OCX 的初始化阶段被调用一次,但在我更改控件大小时从未调用过。

4

1 回答 1

0

正如 Roger Rowland 所说: OnDraw() 可以解决问题。

于 2013-04-16T08:33:09.750 回答