VS 2008 - Drawing Graph On PictureBox Using Coordinates
Sep 21, 2009
VB 6 has a ScaleHeight and ScaleWidth property which VB 2008 does not support and this is causing me fits to work around. I'm trying to draw some lines (a graph) on a Picture Box (or a Panel) using my own coordinates (not pixels). This can't be all that hard can it?
View 3 Replies
ADVERTISEMENT
Jan 9, 2011
I am new to vb.net, from VB6. Trying to understand drawing a simple line graph into a picturebox, which was so simple in VB6 ! From code snippets, I can see the basic idea using an bitimage to draw the lines and then showing it in a picturebox. I don't understand how to (simulate) scaling of the bitmap's x/y scales like you could do with VB6's .Scale.
View 1 Replies
Nov 21, 2009
My problem is centering the 0,0 points of my graph to the center of my picturebox
Dim picBoxWidth As Integer = picGraf.Size.Width
Dim picBoxHeight As Integer = picGraf.Size.Height
Dim halfWidth As Integer = picGraf.Size.Width / 2
[code]....
So how to I tell it to start at the center of my picturebox names (picgraf) btw.
View 1 Replies
Sep 30, 2009
my assignment is to draw a graph within my VB form with a some variables I have. I was told by my boss that I should use Microsoft Chart Control 6.0, but I don't think it matters if it is in another software.I currently have a few variables, each with a lot of values, "Frequency", which is user entered from maximum to minimum, CH (channel) 1-4 which are given by a machine output I use at my company. My graph, is supposed to have the Frequency values in the X-Axis (horizontal) and the CH 1-4 values within a range of each other in the Y-Axis. Can anybody help? My code for extracting the data and getting the frequency is below. How I got most of it is thanks to Stanav, the thread is over here: url...It comes with 3 buttons (I have not put in the code for button 3), the 3rd button will be used for plotting the graph when clicked.
View 3 Replies
May 15, 2012
How do I find the color of a pixel at a certain coordinate of an image in a picturebox?
I found a bunch of tutorials but they are irrelevant and do not work for vb 2008 express.
View 8 Replies
Nov 21, 2010
This control takes in an array and plots a bar chart type 'count' along the Y axis for a corresponding X location. A user has requested to be able to mouse hover over any location on the graph and have it display the X and Y coordinates.
Option Strict On
Option Explicit On
Imports System.Windows.Forms
[Code]....
View 6 Replies
Feb 2, 2011
Lets say that I've got the coordinates of two Rectangles, they could be right next to each other or have space between them. I need to draw a PolygonHotSpot around the two rectangles (so it will only cover the two rectangles and the space between them). I've come to find that I have to give the coordinates a clockwise order around the entire polygon, rather than around each rectangle (which works fine for a single rectangle).
So given a list of coordinates, is there a way to get them into the order that I need for there to not be any gaps in my PolygonHotSpot?
View 1 Replies
Oct 7, 2011
Okay, I've got a rectangle shape named Header and in the form class I Dim a new rectangle named DrawingRect. Here is the code that I used to set the location coordinates and size.
Dim DrawingRect As New Rectangle(Header.Size.Width - 18, Header.Size.Height - 17, 14, 14)
Whenever I run the program, however, it stops me and says "InvalidOperationException was unhandled". How do I get this to work?
View 3 Replies
Apr 13, 2011
I'm basically trying to make a simple, easy-to-use, paint program. I seem to be having problems with using multiple colors in the PictureBox1_Paint option. It draws the graphics but when you change the brush color and click in the picturebox it changes the colors of the previous graphics to the color you are currently trying to use. I need it to allow multiple colors.
Here's the code that I'm currently using..
Imports System.Drawing.Drawing2D
Public Class DynosPaint
Inherits System.Windows.Forms.Form
Private IsFormBeingDragged As Boolean = False
[code]....
View 3 Replies
Apr 13, 2011
I'm basically trying to make a simple, easy-to-use, paint program. I seem to be having problems with using multiple colors in the PictureBox1_Paint option. It draws the graphics but when you change the brush color and click in the picturebox it changes the colors of the previous graphics to the color you are currently trying to use. I need it to allow multiple colors.
Here's the code that I'm currently using..
Imports System.Drawing.Drawing2D
Public Class DynosPaint
Inherits System.Windows.Forms.Form
[code]....
View 1 Replies
Aug 25, 2009
My graph code works but i'm afraid it may not be efficient. I'm drawing a graph on a form using GDI. Basically, i'm making the entire form one big graph. Is this the best approach to creating a graph:
Private Sub frmGraphPaper_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim g As Graphics = e.Graphics
[code].....
View 4 Replies
Aug 3, 2009
I'm drawing a chart in a pictruebox with a sub called Techart. After that I'm trying to turn the drawing into a bitmap, so that it will be persistant and also so that I'll be able to save it. This is what I've got from searching the forum:
[Code]...
View 5 Replies
Jun 20, 2009
I'm having difficulty drawing a graph using a picturebox and the graphics type. For some reason my graph doesn't load, even if I put thec code at the end of the on load event. But it works fine of I assign it to a button.
View 2 Replies
Sep 2, 2009
The problem is I have 10 nodes(say) and there are some connections between them. Now I want to draw a visual graph depicting the above with circles as nodes and lines as connections between them. My problem is what is the algorithm for placement of nodes on screen, say we have drawn one circle, then the other circle should be drawn as non-overlapping as possible.
View 1 Replies
Apr 19, 2009
if there's a way to just display the latest Symbol when drawing a graph. My app displays "real time" data from a pointPairlist and I want one graph just to be a + mark with no trace.
Dim myCurve As LineItem = m_graphPane.AddCurve("", m_pointsList, Color.Red, SymbolType.Plus)
This will show a red line with a + with every pointpair, I just want to display the latest pointpair, as an +.
View 2 Replies
Nov 27, 2009
drawing 2D color coded graph in vb 2005
View 2 Replies
May 1, 2010
I have a problem. Im trying to create a form that enables a user to add dots on a mouse click event over an office floor plan. I have searched the web and this site but still am struggerling. My aim is to be able to draw dots (purpose is to highlight problems) and polygons over the plan (purpose to define which service area the floor area relates). I want to save all graphics to an access database with associated
fields.
My thinking is to place a second picture box over the first and make this transparent and use this as the user interface? I dont expect anyone to solve this for me, however, any help with how to draw dots and polygons through mouse down or mouse click would be most helpful.
View 3 Replies
Feb 18, 2012
I need some code to draw a resizable, draggable rectangular cursor (or selection box) on a picturebox. I found some excellent code (albeit rather old) that does just that, but on a form rather than a picturebox. I have tried converting the code - basically moving things to the picturebox events (Paint, MouseDown, MouseMove etc). It nearly works but leaves a trail behind it when you move or resize the cursor. In other words, the selection rectangle is not being erased before being drawn in the new position.
Is there some fundamental difference between drawing graphics on a form and drawing on a picturebox that would cause this behaviour? Something like, when you invalidate a form and cause a redraw it erases what you did last? If not, then I just need to dig a bit further and work out how the cursor is being erased from the previous position.
Here's the original code that works fine on a form:
Private DragRect As New RectangleF(20, 20, 100, 80)
Private Adornments(7) As RectangleF
Private MouseInRect As Boolean = False
[Code]....
View 1 Replies
Feb 27, 2010
Show coordinates in picturebox?
View 1 Replies
Oct 25, 2010
With VB2008 I am working with a picturebox that I am capturing the pointer position on a mouseup event. I am using the following to get the mouse location
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp
Dim mp As Point = PictureBox1.PointToClient(MousePosition)
'...
End Sub
This appeared to work fine until I tested it on a Windows 7 system. The mouse position it captures is wrong (is offset from the actual click). If you make multiple clicks, they are positioned correctly relatively to each other, but they are skewed away from the point(s) you are actually clicking. It�s like they are off a fixed amount. It works 100% in Win XP. Could it have something to do with the Aero theme on Win 7? Would this happen to be a known issue or result from a common coding mistake?
View 3 Replies
Feb 6, 2010
Does anyone know how to set the x and y coordinates of the image inside a picturebox.
View 7 Replies
Feb 9, 2010
I have this code which creates a picturebox during runtime and displays line graph but I always get an error in this line: gr1.DrawImage(pic1.Image, -m_Dx, 0) 'it says Value cannot be null. Parameter name: image
code
Public Class Form1
Private Const m_Dx As Single = 1
Dim data As Integer = 1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim pic1 As New PictureBox
[Code]...
View 1 Replies
Jan 18, 2011
I've looked and tried.. and for some reason just don't seem to be getting right now.
I have a picturebox that is 250x500, I want to draw a vertical line from the top to the bottom.
Using gs = pbMap.CreateGraphics
'Do While x.X < 250
'gs.DrawLine(Pens.Red, x, y)
[Code].....
View 7 Replies
May 27, 2010
My program is giving the error: "End of statement expected" The red lines are the ones giving errors. I'm trying to draw lines on a picturebox to create a graph
Dim iScale As Single
Const Distance = 1000
pictureBoxGraph.ForeColor = QBColor(0)
[Code]....
View 16 Replies
Jul 28, 2009
This form has a picturebox and a button. The program draws a random line onto the picturebox every time the button is pressed. I want to modify the program so that it also draws a line onto the picturebox when the program is first run. I added a draw() to the form_load event but that didn't work. What do I need to do?
Public Class Form1
Dim x1 As Integer
Dim y1 As Integer
[code]....
View 1 Replies
Sep 25, 2011
I have here a code to draw on a picturebox and when I am trying to save the drawing, it seems that it cant detect whats inside the picturebox.
Here is my
Public Class Signature
Inherits System.Windows.Forms.Form
Dim mousePath As New System.Drawing.Drawing2D.GraphicsPath()
Dim myAlpha As Integer = 100 ' declare a Alpha variable
Dim myUserColor As New Color()
Friend WithEvents btnSave As System.Windows.Forms.Button
[Code] .....
View 11 Replies
May 26, 2010
I have try many different methods but still no avail.how to do this? As i found a good tutorial over
here where it create a resizable rectangle on a form. But what i want is on a picturebox with image.
View 7 Replies
Oct 7, 2009
I got down the drawimage part. The problem I am having, is when I draw another image, it replaces the old one. Here is my
vb
Public Class Form1
Dim PicPoint As Point
[Cod].....
View 27 Replies
Feb 22, 2009
How can I save the drawing that is in a picturebox to file?
Here is my code so far:
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles PictureBox1.MouseDown
If e.Button = MouseButtons.Left Then
[CODE]..........................
View 2 Replies
Mar 13, 2012
I've problem with clearing the drawing in PictureBox. The parts of a drawing are created with PictureBox1_ Paint Event like this: Name is one of the Subs (just part of a drawing). I've created a second event Timer1_Tick in which I want to clear the drawing created before but I can't reach it just with g.Clear(Color.White).
View 8 Replies