Solved

ActiveX Control colors in Properties Window

Posted on 1998-12-01
3
142 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…

685 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