Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Sep 2002
    Location
    Detroit, Michigan, USA
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Color picker (WD2K)

    Can someone suggest the bes way to implement a simple color picker on VBA? The idea is to have a 12 color or so roll up list or something like that , from where to choose -consistently- a certain color. Are there any controls out there?. The option to call the Win API to display the native color dialog form seems a little cumbersome to implement...therefore I was wondering whether there is something simpler out there. Thanks in advance.

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Color picker (WD2K)

    The attached might help - we can discuss.

    I have a command button called "Background", and each click on it rolls to the next in a set of about 9 pre-defined colours. Each time I click the command button, I get the next colour definition from my INI file and apply that colour to the command button. The last colour picked is the one I use as background on my web pages.

    I have attached some of the code and a snippet of the INI file.

  3. #3
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Jeddah, Saudi Arabia
    Posts
    243
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Color picker (WD2K)

    You don't need any API calls to invoke the native color dialog.

    Just add a Microsoft Common Dialog Control (I use version 6) to the toolbox and drag it onto your form. Let's call it cd.

    Then in code.

    cd.ShowColor will show the color dialog.

    You'll have to add code to handle the cancel button being clicked.

    The cd.Color property will give you what you need.

    Regards,

    Kevin Bell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •