Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Adding an Property Color to an ActiveX control.

Posted on 2002-05-10
3
Medium Priority
?
179 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 600 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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.
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…
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…
Suggested Courses

609 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