Change VB form Colors

Hi all,

I would like to change the color of a form in VB 6.0. Is there any WIN32 API function or any other Visual Basic function which gets the form handle and changes the color of the form.
Just setting form.backcolor does not help as they do not change the color of other controls and menus. I would like change the default color of the whole form.


Pls reply asap.


Thanks,
Sugan




Answer this question

Change VB form Colors

  • byang

    It is surprising that you have a command button that does not have command button porperties.
    If you're good enough to make a custom button, you should be good enough to color it, or overlay some kind of graphics on it.
    Is it using an icon or other image as part of the customisation



  • Janeli8

    Thanks for your response.

    I also used a control loop to change the color of all the controls.

    But the problem is, i have a custom built command button which does not have backcolor property.

    I want to know, is there a way to change the color of the custom built command button by using the handle of the command button.

    Thanks again,

    Sugan



  • Amitkm

    as far as i know, this forum is for .net only.. i dont think that vb6 questions are going to be answered.. (if i might have an idea i would have posted it, sorry)

  • NikonC

    Hi Sugan,

    You are posting this question in the wrong forum. These forums are for VB.NET

    Please read through the post at the top of the thread list (under Announcements and FAQs) entitled Please Read Before Posting - How to get the optimal response to your Question which provides a link to the correct forum for VB 6.0.

    Be sure to read the Announcements and FAQs in that forum too before posting.

    Hope that helps you find a solution.

    Thanks
    Mark


  • Chris Sorsby

    You simply want to change BackColor and ForeColor for each control

    Once the new Color is selected:

    In VB2005 the new Collection method should work.
    Add all the controls to the Collection, then for Each member set the colors.

    In VB6, you would probably need to write a Sub to list out explicity all controls and change the colors one by one. That should not take too much time either. If you have a long list of the same type of control (say 20 textBoxes), you can use the Array plus For-loop to limit the number of lines of code.

    General comment: I don't mind seeing questions about VB6. In fact I think one should add the VB6 forum to same page as VB (IDE / Lang / Gen). Many of us are still using both, and logically if VB2005 works, the questions about VB6 should disappear on their own.


  • Change VB form Colors