• Matching the button colour (A2000)

    Author
    Topic
    #390463

    Recently I upgraded my hardware and improved the screen and graphics. I have now realised that most of my forms look awful because the grey I have used for most of the text boxes, and some backgrounds, is different from the grey of buttons. When I select grey from the toolbar dropdown I get a background of 12632256 whereas the button background is minus2147483633. This value can’t be selected from the colour swatch (I don’t even understand why it is a minus number). Is there an easy way of selecting the button grey colour without having to enter the colour code manually?

    Viewing 0 reply threads
    Author
    Replies
    • #693660

      Hi David,

      The negative color values are the system colors you can set in the Appearance tab of the Display Properties control panel. These are not fixed colors, but depend on the user’s individual settings. Buttons may be grey in your Windows, but purple in somebody elses. The color value is -2147483633 in all cases. You can find the values involved as follows:

      Switch to the Visual Basic Editor (Alt+F11) (don’t worry, there is no programming involved)
      Activate the Object Browser (F2)
      Type systemcolor into the search box and press Enter.
      You will see a list of SystemColorConstants named vb3DDKShadow etc.
      If you click on one of them, you will see its value in the lower pane of the Object Browser.
      You can select this value and copy it to the clipboard (Ctrl+C)
      The button color is vbButtonFace. Other useful constants are vbButtonText (the color of the caption of a button – default is black), vbWindowBackground (the standard background color of a window in an application – default is white) and vbWindowText (the standard color of text – default is black).

      • #693702

        Hi Hans

        Thanks for the explanation. I have changed my default Windows colours to make matching easier. I hadn’t realised that buttons could be any other colour and it certainly makes the job of tying down the design of forms much harder if in fact users can change elements that Access doesn’t allow us to change.

        In code I’ve now found a new set of constants thanks to your advice and will use them in my code instead of the constants I have defined myself for colours. Its a pity though that we can’t use these vb constants in properties dialogs whilst we are designing forms.

        Again many thanks

        • #693704

          >> Its a pity though that we can’t use these vb constants in properties dialogs whilst we are designing forms.

          It certainly is a nuisance (even in Access 2002.) Strangely enough, you can choose between system colors and palette colors (fixed colors) when designing UserForms in other Office applications and in VB6 (see screenshot).

          • #693858

            But remember, Access uses different forms and controls from VB and the rest of Office. shrug

            • #693885

              I know, but it would be very convenient to be able to select a system color directly instead of copying and pasting from the Object Browser or typing the value directly. It shouldn’t be too difficult for the Access group inside Microsoft to get a copy of the VB color select dialog from their colleaugues.

    Viewing 0 reply threads
    Reply To: Matching the button colour (A2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: