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
Solved

Adding an Property Color to an ActiveX control.

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

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

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 …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…

828 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