Solved

Adding an Property Color to an ActiveX control.

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…
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…

863 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

24 Experts available now in Live!

Get 1:1 Help Now