Solved

Adding an Property Color to an ActiveX control.

Posted on 2002-05-10
3
176 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
[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
 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 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…

734 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