Solved

Adding an Property Color to an ActiveX control.

Posted on 2002-05-10
3
171 Views
Last Modified: 2010-05-02
I'm trying to add in an Color Property to the control I'm creating. I want it to act like the BackColor Property and access an an StandarColor Page.

How do I do this?

0
Comment
Question by:PPaul
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
Matti earned 150 total points
ID: 7002735
Hi!

If you wan't the Color Property's apper in properitys dialog as VB activeX controls do, also can add more of these it's easy to use a extra label control or a control which has this properity and map this properity to your control as different name.

Use ActiveX control interface Wizard.

Go to VB IDE menu Add-Ins start Add-In manager and load this wizard and run it. It has stdnames on list selct only BackColor Then use it to map these properity names Usercontrol then you shuld have it.


Save the existing code as backup firts the Wizard makes modifications.

Here is one simple mapping code:

Public Property Get BackColor() As OLE_COLOR
    BackColor = UserControl.BackColor
End Property

Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
    UserControl.BackColor() = New_BackColor
    PropertyChanged "BackColor"
End Property

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

    UserControl.BackColor = PropBag.ReadProperty("BackColor", &H8000000F)
End Sub

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

    Call PropBag.WriteProperty("BackColor", UserControl.BackColor, &H8000000F)
End Sub

Matti
 
0
 

Author Comment

by:PPaul
ID: 7002896
Great thanks... one more things what wizard are you talking about? I'm a delphi programmer most of the time..
have incresed point bu 50 for such a quick answer :)

Thanks
PPaul
 
0
 
LVL 14

Expert Comment

by:Matti
ID: 7003077
Hi!

VB IDE menu Add-Ins start Add-In manager and load this wizard and run it.

Available only it a control project is loaded

Go to Add-Ins > Add-In Manager

On that list:

"VB 6 ActiveX Ctlr Intreface Wizard"

It cold be on the menu if it's loaded from the manager.

Do map properities to the control, standard names are available there, just select the one you need. It has helpfile. This is one of the best wizards whit VB.
 

Matti
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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.
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…
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…

746 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

17 Experts available now in Live!

Get 1:1 Help Now