X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Color Blender    
post Apr 5 2008, 01:00 PM

UtterAccess VIP
Posts: 3,085
Joined: 4-November 04
From: The Land of the Access Ninja's

I have built this database tool to help members when they are designing forms and there controls and want to mix and match various colours. There are similar online ones but i want to build one native to Microsoft Access.

Basically you select two colours then say how much blend colors you want to return and then click the blend button. Access then returns the increments of the various colors between the two with there respective color number. See screen shot below.

For example if I use the various returned colors from selecting yellow and blue from the access color blender I can customize a form with various tones as indicated below. Please don’t laugh at my color matching skills it is just an example.

It is tedious for someone to create a form with various colors and then manually recreate all the other forms within their database the same way. Therefore I am also adding some code which loops through all the forms in a database and applies various colors to it.

So after you style one form you can pass their color values to this code which applies the same colors to all forms in your db.
Note: Make a backup of your db before running this code
' Procedure : ChangeFormLook
' DateTime  : 1/19/2006 07:51
' Author    : Dane Miller
' Purpose   : For the purpose of changing form and form controls layout/dispaly.
' Arguments :
' Returns   :
' Modification History:
' Who        When           WHY
'I have listed all the main controls that would be on a form in the Select Case statement.
'In the Label I have included some of the commonly used properties. Of course you
     ' can have more according to what you want to do.
'The Intellisense within the With statement will not show up the form properites like
'You would have to get this information from the FORMAT Properties on the control and
'then manually type then in the code.
Public Sub ChangeFormLook()
Dim obj As AccessObject
Dim frm As Object
Dim Ctl As Control
Dim frmName As String
Set frm = CurrentProject.AllForms
For Each obj In frm
    frmName = obj.Name
    'If FrmName = "YourFormName" Then       'If you want you can use this (IF-statement)
                                                       'when dealing with selected forms only.
    Debug.Print frmName                     ' For testing purposes only.
    DoCmd.OpenForm frmName, acDesign
    Forms(frmName).Section(0).BackColor = vbWhite 'You can search for "Section Property"
                                                              'setting to understand this part
    For Each Ctl In Screen.ActiveForm.Controls
        Debug.Print Ctl.Name
        With Ctl
            Select Case .ControlType
            Case acLabel                    'Label
                    .FontWeight = 700
                    .FontSize = 12
                    .FontName = "Arial"
                    .BorderColor = RGB(255, 34, 32) 'OR vbYellow, Or "Decimal Number"
                    .BorderStyle = 6    'Dash Dots
                    .SpecialEffect = 4  'shadowed
                    .BackColor = 42786
                    .BackStyle = 0      'Transparent
            Case acBoundObjectFrame         'Bound object frame
            Case acCheckBox                 'Check box
            Case acComboBox                 'Combo box
            Case acCommandButton            'Command button
            Case acCustomControl            'ActiveX (custom) control
            Case acImage                    'Image
            Case acLine                     'Line
            Case acListBox                  'List box
            Case acObjectFrame              'Unbound object frame or chart
            Case acOptionButton             'Option button
            Case acOptionGroup              'Option group
            Case acPage                     'Page
            Case acPageBreak                'Page break
            Case acRectangle                'Rectangle
            Case acSubform                  'SubForm / SubReport
            Case acTabCtl                   'Tab
            Case acTextBox                  'Text box
            Case acToggleButton             'Toggle Button
            End Select
        End With
    Next Ctl
    DoCmd.Close acForm, frmName, acSaveYes
        'End If
Next obj
End Sub

I hope someone finds all this helpful.

Edited by: DougY on Sat Apr 5 15:44:09 EDT 2008.
Attached File(s)
Attached File  Color Blender.zip ( 40.53K )Number of downloads: 456
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    5th June 2020 - 01:48 PM