Fill Colors

J

Joe Royle

I'm fairly new to Programming in Visio, I have used it quite extensively for
diagramming.

I am trying to change the color of a shape when doubleclicking on it. I
have tried looking through the helpfiles and on the web, but haven't been
able to find a solution for this.

Any help would be greatly appreciated.
 
R

Rmckenna

in the shape sheet for the desired shape

is the eventdblclick place the following:
=IF(FillForegnd>13,SETF(GetRef(FillForegnd),0),SETF(GetRef(FillForegnd),GetVal(FillForegnd)+1))
 
R

Rmckenna

Ancipating your next question: How can I use predetermined colors?


Create a user row called User.ColorList
Place in this row the string: "RGB(120, 0, 120);1;3;4;RGB(120, 120, 120)"
notice the spacing - it is critical - RGB is self explanitory, but 1;3;4
are preset visio colors.

In the eventdblclick place the following code:
SETF(GetRef(FillForegnd),INDEX(IF(LOOKUP(GetVal(FillForegnd),User.ColorList)<1,4,LOOKUP(GetVal(FillForegnd),User.ColorList)-1),User.ColorList))


Others might have a better solution or beable to improve on this one
 
R

Rmckenna

I neglected to state in the code,


In the eventdblclick place the following code:

SETF(GetRef(FillForegnd),INDEX(IF(LOOKUP(GetVal(FillForegnd),User.ColorList)<1,4,LOOKUP(GetVal(FillForegnd),User.ColorList)-1),User.ColorList))


The value 4 is the number of colors in your list minus 1. Everything is zero
based, so the first element is 0 and so on. It takes the list and goes
backwards, you could easily set it up to go the other way.
SETF(GetRef(FillForegnd),INDEX(IF(LOOKUP(GetVal(FillForegnd),User.ColorList)=4,0,LOOKUP(GetVal(FillForegnd),User.ColorList)+1),User.ColorList))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top