A Visio Deck of Cards

Sometimes I try ideas out in Visio without a specific goal in mind, and I have been creating a Visio deck of cards recently, so I thought I would share it. In fact, I have only created one card but it is capable of being any card in the deck by changing its shape data! I can even get a randomly generated card … all without any code except for formulas in the ShapeSheet.

Firstly, I used four icons for hearts, clubs, diamonds and spades, from my set of metro icons stencils ( see https://blog.bvisual.net/2012/11/20/announcing-metro-icons-and-a-windows-app-tile-shape-for-visio/ ). I decided to keep the icons for the suits separate, with four per suit, but linked their visibility to a Suit Shape Data fixed list row. I also displayed the Value Shape Data as the text of each icon.

imageI added a Face Up Shape Data row so that the suit and value are hidden by the Microsoft Office logo.

I also created a Card Rack shape that automatically drops four playing cards into it when you drag and drop it on the page.

image

The Legend shape is the Microsoft one, and it will display the number of cards dropped onto the page that it is placed on.

Each card has Shape Data

  image 

Alternatively, the right-mouse menu of the card shape provides the ability to change most of the Shape Data, and features some nice suit icons to boot!

image You can select a bank of cards together and change their shape data, such as Face Up, all in one go.

image

These playing cards were automatically laid out from the linked data recordset in the accompanying Visio document.

image

The alternative colors for the sight impaired can be displayed with the simple change of a page shape data value.

image

Now that I had a playing card shape that I am happy with, then I could start playing with how to use it!

So, I used the RAND() ShapeSheet function to generate a random number between 0 and 51, and then I converted this into one of the suit and values.

The formula for this action used on drop, if the DealOnDrop value is TRUE, and by the playing card right-mouse menu DEAL actions, is:

=SETF(GetRef(User.RandomValue),INT(RAND()*52))

Then, when the value of User.RandowValue changes, the following formula converts the number into a suit and value index, and pushes these values into the relevant Shape Data rows:

=DEPENDSON(User.RandomValue)+SETF(GetRef(Prop.Suit),"=INDEX("&INT(User.RandomValue/13)+1&",Prop.Suit.Format)")+SETF(GetRef(Prop.Value),"=INDEX("&MODULUS(User.RandomValue,13)&",Prop.Value.Format)")

These User-defined cell formulas provide the ability to drop a playing card with a randomly generated value onto the page, or I can use the Card Rack shape to automatically drop four cards, then insert more afterwards.

image

All I need now is to create a game with these cards … apart from Snap when the RAND() function provides the same card again!

The PlayingCards.vsdx Visio 2013 document is available from http://1drv.ms/1vkt0yv

Happy holidays….

3 Responses to “A Visio Deck of Cards”

  1. A Visio Countdown to Xmas | bVisual - a blog for people interested in Microsoft Visio Says:

    […] presented a Visio deck of cards in a previous post ( see https://blog.bvisual.net/2014/12/03/a-visio-deck-of-cards/ ), and now I present a real game that can be played with Visio over the holiday season. Countdown […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

davecra.wordpress.com/

Microsoft Office Development, and more...

PowerShell.Amsterdam

Automate, Accelerate, Accurate

johnvisiomvp

Life with Visio and other Microsoft Toys!

Title (Required)

Windows Server Essentials Tips & Tricks

Nilsandrey's Weblog

Just another WordPress.com weblog

Things that Should be Easy

Every so often (too often in the IT industry) I encounter things that should have been very easy to do but turned out to be far too complicated. My favorite topics include SharePoint, .Net development, and software architecture, especially distributed systems.

Visio Guy

Shapes, Stencils, Drawings Templates, Tutorials, Tips & Developer Info for Microsoft Visio

Hannes's Virtual Earth

Tips & Tricks around Mapping and Cloud Computing

Pluralsight blog

be smart, be clear, be visual ...

%d bloggers like this: