|
-
Mar 26th, 2008, 06:43 AM
#1
Thread Starter
New Member
x-y axis
I have to draw a x- and y-axis in a picturebox, and I have no idea how to get started
-
Mar 26th, 2008, 06:48 AM
#2
Hyperactive Member
Re: x-y axis
Sorry your going to have to clarify the question are you drawing a graph?
-
Mar 26th, 2008, 06:49 AM
#3
Re: x-y axis
Take a look at the Paint event.
You'll see that the Paint eventhandler provides this parameter:
VB.NET Code:
e As System.Windows.Forms.PaintEventArgs
Take a look at the different members of this 'e' object. You'll find that its very straight forward to draw anything on the PictureBox.
-
Mar 26th, 2008, 06:50 AM
#4
Thread Starter
New Member
Re: x-y axis
yes
like this: y = ax² + bx + c
-
Mar 26th, 2008, 06:58 AM
#5
Frenzied Member
Re: x-y axis
Put a picturebox on a form and a textbox
make the form and the picture box color black
Code:
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Right Then
Dim g As Graphics = Me.PictureBox1.CreateGraphics
Dim p As Pen = New Pen(Color.White, 1)
Dim sStart As Point = New Point(0, 0)
Dim eEnd As Point = New Point(CInt(Me.TextBox1.Text), 0)
g.DrawLine(p, sStart, eEnd)
End If
End Sub
then hit the right arrow key
forgot that bit
Last edited by toecutter; Mar 26th, 2008 at 07:02 AM.
-
Mar 26th, 2008, 07:00 AM
#6
Re: x-y axis
Dont create the graphics object like that. Use the Paint event.
-
Mar 26th, 2008, 07:01 AM
#7
Hyperactive Member
Re: x-y axis
You could just make a graph using excel and import it into your project as a picture.
-
Mar 26th, 2008, 07:06 AM
#8
Frenzied Member
Re: x-y axis
 Originally Posted by Atheist
Dont create the graphics object like that. Use the Paint event.
Will it still work using the TextBox1_KeyDown event?
-
Mar 26th, 2008, 07:08 AM
#9
Re: x-y axis
 Originally Posted by toecutter
Will it still work using the TextBox1_KeyDown event?
Yes. You'd call the PictureBox' Refresh or Invalidate+Update methods in the KeyDown eventhandler.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|