Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generating 256 color choices
Message
 
 
To
06/04/2002 15:58:25
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00605952
Message ID:
00641851
Views:
18
Add following code after the last ENDFOR
    lnInc = 255/(2^4-1)
    For lnColor = 0 to 2^4-1
        STORE round(lnColor * lnInc,0) TO lnRed, lnGreen, lnBlue  
        lnShp  = lnShp+1
        lcName = 'shp'+trans(lnShp)
        lcLblName = 'lbl'+trans(lnShp)
        .addobject(lcName, 'myShape', ;
          lnShp, lnPerRow, lnRed, lnGreen, lnBlue)
        lcWebColor = right(trans(rgb(lnBlue,lnGreen,lnRed),'@0'),6)  
        lcHTML = lcHTML + ;
          iif((lnShp-1)%lnPerRow=0,'&;lt/TR&gt&ltTR&gt','') + ;
          '&ltTD bgcolor=#'+lcWebColor+'&gt'+lcWebColor+'&lt/TD&gt'
    
     Endfor
Change
.Height = 20 * 16
* to
.Height = 20 * 17
>>You could either use something like this or get HTML directly from MSDN help (named colors) :
>>
>>
lcHTML = '<HTML><BODY><TABLE><TR>'
>>oForm=createobject('Form')
>>With oForm
>>  .ShowTips = .t.
>>  lnPerRow = 16
>>  Store 255/(2^3-1) to lnRedInc, lnGreenInc
>>  lnBlueInc = 255/(2^2-1)
>>  lnShp=0
>>  For blue = 0 to 2^2-1
>>    For green = 0 to 2^3-1
>>      For red = 0 to 2^3-1
>>        lnRed = round(red * lnRedInc,0)
>>        lnGreen = round(green * lnGreenInc,0)
>>        lnBlue = round(blue * lnBlueInc,0)
>>        lnShp  = lnShp+1
>>        lcName = 'shp'+trans(lnShp)
>>        lcLblName = 'lbl'+trans(lnShp)
>>        .addobject(lcName, 'myShape', ;
>>          lnShp, lnPerRow, lnRed, lnGreen, lnBlue)
>>        lcWebColor = right(trans(rgb(tnBlue,tnGreen,tnRed),'@0'),6)
>>        lcHTML = lcHTML + ;
>>          iif((lnShp-1)%lnPerRow=0,'</TR><TR>','') + ;
>>          '<TD bgcolor=#'+lcWebColor+'>'+lcWebColor+'</TD>'
>>      Endfor
>>    Endfor
>>  Endfor
>>  lcHTML = lcHTML+'</TR></TABLE></BODY></HTML>'
>>  Strtofile(lcHTML,'256Colors.htm')
>>  .SetAll('Visible',.t.)
>>  .Height = 20 * 16
>>  .Width = 20 * 16
>>  .Show
>>Endwith
>
>
>What would need to be modified in here to allow a palette of gray colors? Basically, from white to black would be ok.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform