[help] - hi, some help in a "graph" [Solved]

Posts 1–9 of 9 · Page 1 of 1
[help] - hi, some help in a "graph" [Solved]
HI,
I've been away from programing and MPGH for a while now... But now I'm back xD

And I need some help...

I I'm trying to make a program the "draws" the stuff that I input... Like I want it to make a line somewhere, I insert the coordinates and it draws the line...

I don't know if any of you know what descriptive geometry is but its something like that...
You have x,y and z... lets say, the coordinates (1,2,3) are X=1 Y=2 and Z=3... (just like that stuff that you learn in maths in the 10th grade)

I don't know if I'm making myself clear.... so heres a picture of what I'm trying to know how to do:



I insert the data ( in this case 2;4;2) and it draws the points.... (yes, I have a "form" with the place to insert the data, all I have to do its to acctualy "work" xP)

PS: I know how to had lines, But I want to know how to had dots and unite two dots and stuff like that...

Ty,
TheRealOne
So.. what's the problem? Using drawline is quite easy.

Graphics Class (System.Drawing)

PS: I know how to had lines, But I want to know how to had dots and unite two dots and stuff like that...
Simple.. DrawEllipse with fill.. What's so hard.. Check the link i gave you

It's all based on Pixels.. Should be simple..
Hum... Didn't know that that existed... (I fell bumb -.-''... stupid question...) I'll see how to work with that and try to do what I want... Ty... I probably won't be back on the pc today, so I'll only post again tomorrow...

ty and sry -.-''
hi again....
I have a doubt... Can you give me an example of how to use the draw line comand?
I have this:
Code:
Public Sub DrawLinesPoint(ByVal e As PaintEventArgs)

    ' Create pen.
    Dim blackPen As New Pen(Color.Black, 3)

    ' Create array of points that define lines to draw.
    Dim points As Point() = {New Point(10, 10), New Point(10, 100), _
    New Point(200, 50), New Point(250, 300)}

    'Draw lines to screen.
    e.Graphics.DrawLines(blackPen, points)
End Sub
But it says that it doesn't recognise "Graphics" as a PaintEventArgs.... can you help me on that? ty... (this is exacly what was on microsoft page...(msdn)... I think that this should be really easy to fix, but for some reason I don't know how to do it...


Thank you
On the form's Paint event, try putting this there:
Code:
Call DrawLinesPoint(e)
Result from your code:


If you want to have a cartesian plane like in your drawing the the first post, you have to do something like this:
Code:
Dim centerX As Integer = Me.Width / 2
Dim centerY As Integer = Me.Height / 2
Dim points as Point() { New Point(centerX + 5, centerY), New Point(centerX - 5, centerY) }
Think centerX and centerY as 0 on a cartesian plane.
centerX + 5 = 0 + 5 = 5.
centerX + 10 = 0 + 10 = 10.
centerX - 10 = 0 - 10 = -10.
Point(centerX - 30, centerY + 20) = (-30, 20)
Hum... SOmething is going wrong...

On your first code it sayed:


[html]Não é possível associar o objecto de tipo 'System.EventArgs' ao tipo 'System.Windows.Forms.PaintEventArgs'.[/html]

That means that it couldn't associate the object (Call DrawLinesPoint(e)) that is from the type System.EventArgs to the type System.Windows.Forms.PaintEventArgs.... Can you give me an example with the full code plz? thank you... or tell me what I'm doing wrong?

thanks...

PS: just if anyone wants to use your second code, I think that (correct me if I'm wrong) your missing the "=" in "Dim points as Point() { New Point(cente..."
PS: thaks a lot for the second code two... I was thinking in a way to do that xP (As soon as I get the first piece of code working I'll use that one tyvm )
Quote Originally Posted by TheRealOne View Post
Hum... SOmething is going wrong...

On your first code it sayed:


[html]Não é possível associar o objecto de tipo 'System.EventArgs' ao tipo 'System.Windows.Forms.PaintEventArgs'.[/html]

That means that it couldn't associate the object (Call DrawLinesPoint(e)) that is from the type System.EventArgs to the type System.Windows.Forms.PaintEventArgs.... Can you give me an example with the full code plz? thank you... or tell me what I'm doing wrong?

thanks...

PS: just if anyone wants to use your second code, I think that (correct me if I'm wrong) your missing the "=" in "Dim points as Point() { New Point(cente..."
PS: thaks a lot for the second code two... I was thinking in a way to do that xP (As soon as I get the first piece of code working I'll use that one tyvm )
Loled @ portuguese error..

Form or Control paint Event... Which contains PaintEventArgs as param.

PS: Basicamente, vai aos eventos do form ou do controlo, e cria o evento de paint, usa o e.Graphics dele para fazeres draw, ou enviares para outra funcao... w/e
Quote Originally Posted by 'Bruno View Post
Loled @ portuguese error..

Form or Control paint Event... Which contains PaintEventArgs as param.

PS: Basicamente, vai aos eventos do form ou do controlo, e cria o evento de paint, usa o e.Graphics dele para fazeres draw, ou enviares para outra funcao... w/e

WoW! finally it worked

Thanks a lot! (all of you)


PS: lol... Quando explicam em portugues fica mais facil =D Obrigado
It has to be on a Paint event, as Brinuz said. Either override the On_Paint procedure or just handle the Form's Paint event.
Posts 1–9 of 9 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us