polygon - Drawing hexagon in vb.net -


i want build hexagon-shaped button. here's code i've got.

dim p(5) point             dim v integer = cint(me.width / 2 * math.sin(30 * math.pi / 180))             p(0) = new point(me.width \ 2, 0)             p(1) = new point(me.width, v)             p(2) = new point(me.width, me.height - v)             p(3) = new point(me.width \ 2, me.height)             p(4) = new point(0, me.height - v)             p(5) = new point(0, v) 

unfortunately, appears hexagon point @ top. want hexagon horizontal line @ top.

thanks!

you can swap x , y coordinates, mirrors shape @ system's diagonal. , adapt scaling width , height accordingly:

dim v integer = cint(me.height/ 2 * math.sin(30 * math.pi / 180)) p(0) = new point(0, me.height\ 2) p(1) = new point(v, me.height) p(2) = new point(me.width- v, me.height) p(3) = new point(me.width, me.height\ 2) p(4) = new point(me.width - v, 0) p(5) = new point(v, 0) 

be aware reverses point order. if processing method relies on that, may need re-order points.


Comments

Popular posts from this blog

php - Autoloader issue not returning Class -

C++ Program To Find Smallest and Largest Number In Array -

java - How to put two numbers separated by a space into two different arrays -