I have finally completed my first stage of the character generation program.

However, I would like to make some adjustment to it, and it involves drawing out irregular polygon. I have conduct a serach on this topic over the internet, and understand that it can only be achieved with API.

Being a starter in visual basic, I am not able to identify the errors of the samples found, thus am not able to amend the script to achieve what I have in mind. As such, I need to troubled you guys again.

Basically, I wish to use the program to draw a polygon to illustrate the results generated.

For example: There are 8 results.

if the result of point1 = 0, then it will not be taken into account
if the result of point2 > 1, then the coordinates of the point of polygon will be (x2,y2)
so on and so forth.
the polygon will be formed by joining the adjcent points (ignoring the point if the result = 0)

in other words, if 5 points of 8 result are 0, the diagram form will actually be a triangle of a designated size.

Can anyone advised me on how this can be done?

Furthermore, It there anyway to locate the coordinates of the point where the mouse is pointed in visual basic?

I'm not quite sure what your first question is, but you might want to go through the list of points and then just drawn a line between all of the points > 0.

Second question: if this is in a form then use the mousemove event for the form. X and Y are given parameters which will tell you the mouse's x,y position on the form.

I do not understand your first question, What is a result?

As BinaryCode said you can get the cursor position "The Beginners way" through the form. You can also get the cursor position with API such as getCursorPos OR DirectInput. However as you state you are a beginner I will remind you that when you get mouse input from the form the X and Y coordinates will be in twips.

I need to draw a polygon based on the results determined through the program.

As mentioned, there will be 8 results being considered, and each result determine the existence of each point.

For example:
If all the 8 results are more than 0, then there will be 8 points where it can be joint up to form a 8 sided polygon.
However, if out of the 8 results, only 3 of them are more than 0, then 5 points will be ignored. Therefore, a triangle (3 sided polygon) is being form instead.

Depending on the result, the coodinates of each point will vary.

x refers to the position of the point along xaxis, while y refers to the position of the point along y-axis

In other words, I wish to know how to draw a polygon where I will assign the points (edge) of the polygon, and the number of sides, depending on the resulted being determined in the program.

Hope the above clarification is clear enough for someone to assist me on this.

I need to draw a polygon based on the results determined through the program.

As mentioned, there will be 8 results being considered, and each result determine the existence of each point.

For example:
If all the 8 results are more than 0, then there will be 8 points where it can be joint up to form a 8 sided polygon.
However, if out of the 8 results, only 3 of them are more than 0, then 5 points will be ignored. Therefore, a triangle (3 sided polygon) is being form instead.

Depending on the result, the coodinates of each point will vary.

x refers to the position of the point along xaxis, while y refers to the position of the point along y-axis

In other words, I wish to know how to draw a polygon where I will assign the points (edge) of the polygon, and the number of sides, depending on the resulted being determined in the program.

Hope the above clarification is clear enough for someone to assist me on this.

Sorry that I failed to explained myself once again.

This time round, to facilitate my explanation, I have enclosed a picture file for reference.

The polygon i have in mind is something as shown in the picture. It will be determined based on the 8 results.

For example, based on a scale of 0 to 5:
0 means that the character has no potential in that particular talent.
5 means that the character specialized in that particular talent.

depending on the results determined, it will affect the shape, and sizes and sides of polygon.

Here's what I am thinking. Instead of just throwing out all the 0s, just draw a line between them, because if you don't it look kind of weird (unless you were planning on doing that). Then you would have an array representing the 8 points that would hold 1 value (integer, long, byte, w/e). Then start with 12 o'clock you would put the point at the array's first value (ie: array(0) = 1; point0.y = 1) and then you would hardcode where each point would go like a graph (array(1) = 2; point2.x = 2: point2.y = 2; gives you a diagnal) then go through each point in the array adding and subtracting the value to put it in it's spot. Then you could either use the vb draw line (look in the object browser under form or picturebox for syntax) or google for a gdi declare for drawing lines. Hopefully that helps you out.

BinaryCode 's method is simpler than mine but here goes:

Are you any good at trigonometry? If so you will realise a pattern with the points:

The top one, we shall call it v(0) and the one to the right of that I will call v(1) and so on.....

If you are using form controls and not DirectX then replace (.x) with (.left) and (.y) with (.top).

The ValueOfSkill array holds the value of each of your "skills".

Code:

for i = 0 to 7
v(i).x = sin(angle * pi / 180) * ValueOfSkill(i)
v(i).y = cos(angle * pi / 180) * ValueOfSkill(i)
next i

IF gonz.beginner = false THEN

For the drawing side of things, start learning DirectX8. This thing would be a doddle in DX8. This is because DX8 deals with vertex data and draws it to the screen AND when you first learn DX8 the first thing you learn how to do is draw a polygon (specifiying vertexes/coordinates).