Drawing 'n' number(s) of hexagon

meggy_e
07-27-2003, 08:03 AM
how to draw hexagon in a picturebox, and what should i do to make it scalable (bigger scale number will make more hexagon in smaller size : the picture box's size is constant) :(

blindwig
07-27-2003, 12:43 PM
how to draw hexagon in a picturebox, and what should i do to make it scalable (bigger scale number will make more hexagon in smaller size : the picture box's size is constant) :(
You should start by writing a routine to draw a hexagon given it's center position and radius. Then you need to write a routine to loop through X and Y values on the picture box, drawing the hexagons. Remember to space the hexagons apart by their radius, so that you have room to draw the next row inbetwen.

GavinO
07-27-2003, 08:02 PM
A hexagon draw routine is essentially a circle draw routine with a really coarse increment. You go like this:

for i=0 to pi*2 step pi/3
line step(0,0)-(radius*cos(i),radius*sin(i))
next i

BillSoo
07-27-2003, 11:48 PM
I posted some code some time ago that drew a hexagonal grid....ah yes, here it is....
http://www.visualbasicforum.com/showthread.php?t=21529&highlight=hexagon

meggy_e
07-29-2003, 06:05 AM
thanks, everyone... i've tried your helps, and i've come to this two codes, but they are all messy, can anyone please check what's wrong with it ?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum