Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MRU and color/color scheme
Message
De
18/11/2005 22:32:06
 
 
À
18/11/2005 16:20:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de menu & Menus
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01068353
Message ID:
01070465
Vues:
22
>>>>
>>>>>Lennert
>>>>
>>>>With regard to colour scheme, what effect do you want to see?
>>>>
>>>>Do you want to define your own colours for Foreground/Background? Do you want to define different fonts for menu items? Add icons?
>>>
>>>I want to define my own colours for Foreground/Background.
>>
>>
>>Lennert
>>
>>Here's a look at some code I composed for another site. It is a step by step method to give you Dynamic Colors for your menubars, Dynamic fonts and Dynamic bmps that can be changed at runtime. Here goes:
>>
>>When desigining your menu in the menu designer of VFP for the menu item you want to change, click on the small button just below Options.
>>
>>This opens the VFP "Prompt Options" dialog box where you specify shortcut, Skip for, Message etc. The field we want is Message
>>
>>1. In the Message field first enter an empty string like so "". You could add some text between the "" if you wanted, but for this exercise just enter ""
>>
>>2. Now enter a SPACE
>>
>>3. Now enter your font string Exactly as I have :
>>
>>FONT "Century Gothic", 20 Style "B"
>>
>>4. Now if you want a bitmap add this :
>>
>>PICTURE "c:\vfp9\fox.bmp"
>>
>>Now the complete string in your Message field is:
>>
>>"" FONT "Century Gothic", 20 Style "B" Picture "c:\vfp9\fox.bmp"
>>
>>Note: Your Preview will not show the new attributes.
>>From the menu select Menu | Generate to generate the MPR file.
>>
>>Run this : DO MyMenu.mpr
>>
>>Now go to the menu and look at the item that you added the above line to. Voila. Picture & Font Attributes.
>>
>>Now open the menu in VFP, go to the Message field (as above), Highlight and CUT out all the code you entered EXCEPT for the "" . Now your Message field should have just ""
>>
>>Type a space and then enter this:
>>&MyMenuVar1
>>
>>Message field now looks like this :
>>
>>"" &MyMenuVar1
>>
>>Save this and generate the MPR file again. Do NOT run it as yet.
>>
>>In your command window type this:
>>
>>
>>MyMenuVar1 = [FONT "Century Gothic", 20 Style "B" COLOR , RGB(255,255,255,192,255,0) PICTURE "c:\vfp9\fox.bmp" ]
>>
>>NOTE: VFP Help File is wrong
>>"COLOR ColorPairList
>>
>>Specifies the colors for an individual menu item, overriding the default colors or the colors specified with DEFINE POPUP. You can specify the colors of all menu items, mark characters, and messages. By default, the colors of menu items are determined by color scheme 2 of the current color set."
>>
>>The above will do NOTHING. You need to enter the colorpair as I have done above, with a comma between the COLOR and the Pair:
>>
>>COLOR , RGB(255,255,255,192,255,0)
>>
>>
>>(Basically you paste the code you cut out of the message field between the [] btackets. Use any small bitmap but you need the full path)
>>
>>Press enter and Public Variable MyMenuVar1 now equals to your string.
>>
>>Now
>>Do MyMenu.Mpr
>>
>>
>>
>>Open the menu to the item you wanted changed and see that it now has a bitmap as well as font attributes. You can change the value assigned to MyMenuVar at runtime and reissue Do MyMenu.Mpr and the menu will take on the new attributes.
>>
>>Type :
>>MyMenuVar1 = [FONT "Century Gothic", 6 Style "B" COLOR , RGB(255,255,255,192,255,0) PICTURE "c:\vfp9\fox.bmp" ]
>>(change the font size to 6 , Backgcolor to green, forecolor to white)
>>
>>
>>Now Do MyMenu.Mpr
>>
>>Open the menu and see that the font size has reduced from 20 to 6 at runtime!
>>
>>So now you know how to do this at design time as well as runtime.
>>
>>You just need to remember to DO the MPR each time you change the attributes.
>>
>>Experiment at changing other properties as defined in the VFP help Define Bar command.
>>
>>Cheers
>
>Thank you very much, Bernard. It is very clear.
>
>Lennert

No Worries!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform