Solved

ActiveX Control colors in Properties Window

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

808 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