Solved

ActiveX Control colors in Properties Window

Posted on 1998-12-01
3
138 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
Comment Utility
Edited text of question
0
 
LVL 15

Accepted Solution

by:
Eyal earned 100 total points
Comment Utility
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
Comment Utility
Thanks Eyal!  Just what I was looking for.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now