Solved

ActiveX Control colors in Properties Window

Posted on 1998-12-01
3
140 Views
Last Modified: 2012-05-04
I'm building an ActiveX control that has four colors, say Color1, Color2, Color3 and Color4 which are properties.  I
would like to have these colors settable in the Properties Window using the dropdown color charts (like those
used for setting the BackColor and ForeColor properties for forms).  How do I do this?
0
Comment
Question by:pjcarlsn
  • 2
3 Comments
 

Author Comment

by:pjcarlsn
ID: 1447696
Edited text of question
0
 
LVL 15

Accepted Solution

by:
Eyal earned 100 total points
ID: 1447697
pjcarlsn put new activex colntrol and put the following code in it.
for the next time you could use the activex interface wizard in the add-ins.

'Default Property Values:
Const m_def_Color1 = 0
Const m_def_Color2 = 0
Const m_def_Color3 = 0
Const m_def_Color4 = 0
'Property Variables:
Dim m_Color1 As OLE_COLOR
Dim m_Color2 As OLE_COLOR
Dim m_Color3 As OLE_COLOR
Dim m_Color4 As OLE_COLOR



Public Property Get Color1() As OLE_COLOR
    Color1 = m_Color1
End Property

Public Property Let Color1(ByVal New_Color1 As OLE_COLOR)
    m_Color1 = New_Color1
    PropertyChanged "Color1"
End Property

Public Property Get Color2() As OLE_COLOR
    Color2 = m_Color2
End Property

Public Property Let Color2(ByVal New_Color2 As OLE_COLOR)
    m_Color2 = New_Color2
    PropertyChanged "Color2"
End Property

Public Property Get Color3() As OLE_COLOR
    Color3 = m_Color3
End Property

Public Property Let Color3(ByVal New_Color3 As OLE_COLOR)
    m_Color3 = New_Color3
    PropertyChanged "Color3"
End Property

Public Property Get Color4() As OLE_COLOR
    Color4 = m_Color4
End Property

Public Property Let Color4(ByVal New_Color4 As OLE_COLOR)
    m_Color4 = New_Color4
    PropertyChanged "Color4"
End Property

'Initialize Properties for User Control
Private Sub UserControl_InitProperties()
    m_Color1 = m_def_Color1
    m_Color2 = m_def_Color2
    m_Color3 = m_def_Color3
    m_Color4 = m_def_Color4
End Sub

'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

    m_Color1 = PropBag.ReadProperty("Color1", m_def_Color1)
    m_Color2 = PropBag.ReadProperty("Color2", m_def_Color2)
    m_Color3 = PropBag.ReadProperty("Color3", m_def_Color3)
    m_Color4 = PropBag.ReadProperty("Color4", m_def_Color4)
End Sub

'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

    Call PropBag.WriteProperty("Color1", m_Color1, m_def_Color1)
    Call PropBag.WriteProperty("Color2", m_Color2, m_def_Color2)
    Call PropBag.WriteProperty("Color3", m_Color3, m_def_Color3)
    Call PropBag.WriteProperty("Color4", m_Color4, m_def_Color4)
End Sub


0
 

Author Comment

by:pjcarlsn
ID: 1447698
Thanks Eyal!  Just what I was looking for.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question