?
Solved

ActiveX Control colors in Properties Window

Posted on 1998-12-01
3
Medium Priority
?
145 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

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

Accepted Solution

by:
Eyal earned 400 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…
Suggested Courses

762 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