Resolver Hacks contains information and code for doing fun and useful things with Resolver One. This site is created and maintained by Michael Foord, not by Resolver Systems. Please read the disclaimer before using any of the code on this site.
Resolver as Image Viewer

An image is a rectangular grid of pixels, each with a single colour. By coincidence, with Resolver we have a grid of rectangles where we can control the colour of each cell. We can also change the row height and column width to make them a little more 'pixel-shaped'.
The image viewer spreadsheet turns Resolver into a very inefficient image viewer.
This spreadsheet has several 'features':
- The grid is turned off so that you can see the image without lines all over it
- You can control individual pixel width and height. The default is 2, 2 - so the image displayed is magnified by two in both dimensions
- It caches the image in between recalculations
- It has a button that allows you to select a new image to load
(WARNING: Don't load big images! About 60x60 pixel pictures are the best to view. The grid isn't really designed to do this and it has to do a lot more work than is reasonable.)

How it Works
The image is loaded using the Bitmap class.
This exposes a Height and a Width property, and we can fetch the colour of individual pixels with the image.GetPixel(x, y) method.
The code iterates over every pixel in the image, setting the BackColor of the corresponding cell in the grid. We control the size of the cells by setting the width and the height of the rows and columns; sheet.Cols[colIndex].Width = width.
yMod = 9
for x in range(image.Width):
colIndex = x + xMod
sheet.Cols[colIndex].Width = int(width)
for y in range(image.Height):
rowIndex = y + yMod
if x == 0:
# We only need to set the row height once
sheet.Rows[rowIndex].Height = int(height)
color = image.GetPixel(x, y)
sheet.Cells[colIndex, rowIndex].BackColor = color
Loading a new image is done with the OpenFileDialog class from Windows Forms. In general you shouldn't use Windows Forms controls from user code, but in fact the file dialogs and system message box are probably safe. Having chosen an image, it is loaded and cached by the Cache module. This means that the image doesn't need to be reloaded for every change, just the first time and when you change images.
When a new image is loaded, a recalculation is then triggered by sending an 'F9' keypress (which is definitely cheating).
Anyway, this spreadsheet has no practical use whatsoever and is only proof that you can do silly things with Resolver.
By the way, if you turn the grid back on, this is what you get:

Last edited Mon Dec 10 18:34:20 2007.

IronPython in Action