通过自定义属性页面更改自定义OLE_COLOR类型属性 [英] Changing a custom OLE_COLOR type property via a custom property page
问题描述
您好,我正在开发一个ActiveX控件,该控件希望能够更改其各个部分的颜色.我知道我可以使用它的股票属性页面.我不希望使用它,因为我想要更大的灵活性.
IDL文件中的声明:
Hi, I''m developing a ActiveX control that I want to able to change the colour various parts of it. I know I can use the stock property page of it. I don''t wish use it, because I want greater flexabitly.
Declartion in the IDL file:
[id(4) , helpstring("property myColour")] OLE_COLOR myColour;
我已将这种轻描淡写作为通知.因此,在控件的cpp文件中
I''ve made the implentaion as notification. Therefore, in the the control''s cpp file
DISP_PROPERTY_NOTIFY_ID(CMyActiveXCtrl, "myColour", dispidmyColour, m_myColour, OnmyColourChanged, VT_COLOR)
有问题的属性页我有一个静态控件,打算将其映射到该属性.声明为:
The property page in question I have a Static control which I intend to map to the property. Which is declared as such:
private:
CColourStatic m_selectedColour; // Subclassed from CStatic
COLORREF m_nColourVal;
现在的问题是,当我取消对DDP_Text行的注释时,当我调用UpdateData时,数据交换不起作用.注释时,仅适用于静态控件.
Now the problem is when I call UpdateData the data exchange doesn''t work when I uncomment the DDP_Text line. When it commented it works for the static control only.
void CColoursPropPage::DoDataExchange(CDataExchange* pDX)
{
// DDP_Text(pDX, IDC_BKCOLOUR_STATIC, (OLE_COLOR)m_nColourVal, _T("myColour"));
DDX_Text(pDX, IDC_BKCOLOUR_STATIC, m_nColourVal);
DDX_Control(pDX, IDC_BKCOLOUR_STATIC, m_selectedColour);
DDP_PostProcessing(pDX);
}
谁能告诉我们如何解决而无需添加股票支持页面.
提前谢谢.
Alton.
Can anyone tell we how to solve without adding the stock prop page.
Thanks in advance.
Alton.
推荐答案
属性getter和setter必须手工完成,其代码在此处[^
The property getter and setter has to be done by hand the code for it is here [^]
这篇关于通过自定义属性页面更改自定义OLE_COLOR类型属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!