ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Looking for Component to Fill Boxes

<< < (2/2)

steeladept:
I don't know of anything off hand, but it really should be quite simple to code.  I did something similar already with a transform to boot.  I can't find the code right now, but nesting squares within a square goes something like this:


--- Code: Text ---square[][] = AddRectangle[10][10]                           //creates the field array 10 squares across in size xloc = 0                                                    //initializes starting x positionyloc = 0                                                    //initializes starting y position for (x = 0, x <= <xarraysize>, x++){                        //where <xarraysize> is the actual array size defined           for (y = 0, y <= <xarraysize>, y++) {                               square[x][y] = AddRectangle(10,10,xloc,yloc)    //where x & y are the array positions & (10,10,xloc,yloc) are the                                                            //size of the individual squares and their position.            xloc = xloc + 10                                //increments the xloc variable by the pixel size of the rectangle            yloc = yloc +10                                 //increments the xloc variable by the pixel size of the rectangle     }}
At least I think that is about what I did.  I will post it if I can find it.  It was originally written in SmallBasic just to prototype the logical concept.  I will be implementing it in Java, eventually for a personal project I have been working on for about 4 years now off and on (more off than on) to learn the language.

Note, if you want variable size internal squares, you can put a variable in in place of the 10's listed above and then just subtract the number of pixels left in the array.  It would, of course, require another variable or two to track the array size in pixels, but that should be trivial to add.

Ath:
You already have it, but it's called WPF...
-Ath (June 02, 2011, 01:32 PM)
--- End quote ---

How so? I'm not sure I'm following you.
-Renegade (June 02, 2011, 09:28 PM)
--- End quote ---

AFAIR you where coding in .NET earlier, and since 3.0 that comes with WPF. It's not that difficult to code that in C#/XAML, I'd have to start a small 'playing-man' project to come up with code, but time is a bit short ATM.

Navigation

[0] Message Index

[*] Previous page

Go to full version