Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AutoCAD Colors in VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00905795
Message ID:
00905901
Vues:
9
Ali,

>Is there a way that I can get AutoCAD’s 256 colors in VFP 6 like what we do with GetColor() function?

It's been a long time since I've used AutoCad so I'm not wure what their 256 colors are, but here's something that might give you a start. It generates a 216 color chart, when you click a color it'll set the form nColor property and tweak the caption.
public oForm

oForm = createobject( "frmColorPick" )
oForm.Visible = .t.

define class frmColorPick as Form

nColor = 0
Width = 268
Height = 400

function Init()
local lnR, lnG, lnB, lnTop, lnLeft, lnId

lnTop = 1
lnLeft = 1
lnId = 0

for lnR = 0 to 256 step 51.19
   for lnG = 0 to 256 step 51.19
      for lnB = 0 to 256 step 51.19
         lcName = "shp" + padl( lnId, 3, "0" )
         this.AddObject( lcName, "shpColorPick" )
         with evaluate( "this." + lcName )
            .Top = lnTop
            .Left = lnLeft
            .FillColor = rgb( int( lnR ), int( lnG ), int( lnB ) )
            .Visible = .t.
            lnLeft = lnLeft + 22
            if ( lnLeft > 264 )
               lnLeft = 1
               lnTop = lnTop + 22
            endif
         endwith
         lnId = lnId + 1
      endfor
   endfor
endfor

endfunc

enddefine


define class shpColorPick as Shape
Width = 20
Height = 20
FillStyle = 0

function Click()
thisform.nColor = this.FillColor
thisform.Caption = transform( thisform.nColor )
endfunc
enddefine
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform