Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
REVERSE RGB(0,0,0,255,255,255) to RGB(255,255,255,0,0,0)
Message
De
13/06/2003 11:19:24
 
 
À
13/06/2003 11:04:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00799797
Message ID:
00799824
Vues:
46
This is what I have so far and it works, but there must be a shorter way to do it:
CLEAR
set talk OFF
set echo OFF
set debug off
oldval="RGB(0,0,0,255,255,255)"
? oldval
ALINES(aMyarray,oldval,",")
DIMENSION part(6)
FOR i = 1 TO ALEN(aMyarray)
    DO CASE
    CASE LEFT(aMyarray(i),3)="RGB"
        part(i)=RIGHT(aMyarray(i),LEN(aMyarray(i))-AT('(',aMyarray(i)))
    CASE AT(")",aMyarray(i))>0
    	  part(i)=LEFT(aMyarray(i),AT(")",aMyarray(i))-1)
    OTHERWISE
        part(i)=aMyarray(i)
    ENDCASE
ENDFOR
newval=""
FOR i = ALEN(part,1) TO 1 STEP -1
	DO CASE
     CASE i = ALEN(part,1) 
          newval="RGB("+part(i)+","
     CASE i = 1
          newval=newval+part(i)+")"
     OTHERWISE
          newval=newval+part(i)+","
      ENDCASE
ENDFOR
?newval
>Use strtran() to convert commas to chr(10), and use alines(), and put it back together...look at one of the messages from me to you the other day...(in an RGB() thread).
>
>
>>I need to create a function that will reverse an RGB settings. If it is 0,0,0,255,255,255 then make it 255,255,255,0,0,0 etc regardless of what the foreground and background settings are. The closest I can get is to using AT for the ',' in the statement and then stripping out the numbers in between and then set it again going backwards from the results. Anyone have a better idea?
>>
>>TIA,
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform