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.
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
I have a question about drawing a string on a picturebox in the form load event. So I have a picturebox on a form and in the form load event of this form I have this code:
Dim gx As Graphics = PictureX.CreateGraphics Dim f As Font = New Font("Arial", 8) Dim brr As Brush = New SolidBrush(Color.Black) ' Add the copyright text gx.DrawString("1", f, brr, 2, 5)
But when I load the program nothing is drawn in the picturebox. Is there something wrong with the code or should I use the paint event of the picturebox?
By the way I also used this code in another program and there it works flawlessly, everything is drawn in the right place there when i load the program.
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.
I've decided to learn Visual Basic .Net as this is what some of my colleagues work with, and this will allow me to work with them on projects.I have purchased Microsoft Visual Basic 2010 Step by Step and downloaded the sample files. When I am trying to debug the first sample application (a Windows form), it is telling me that it can't load System.Drawing V4.0.0.0. However, if I create a new Windows Form application (C# or VB.Net) this works fine.
I had a look at the References tab in the project settings and System.Windows.Forms is referenced, but the version referenced is 2.0.0.0. I have removed and re-added this reference and it stays at 2.0.0.0 and I still get the error.Does anybody have any ideas as to what may be going on?
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.
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.
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 +.
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?
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
I have an desktop application that references several dlls. All are targeted for .Net 3.5, x86. The applicaiton has been deployed for several years and was upgraded from visual studion 2008 to 2010 last year. I have made several changes to the app since then (as recently as last Thursday) with out any issues. Now, everything builds, but when I run the application, I get a type initialiazer error when one of the projects is loaded by the main application.
The error messsage is {"Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.":"System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}.
There were no changes to this project since the last successfuly deployment last week, but today I am getting this error.
Imports System.Data Imports System.Data.OleDb Public Class Form1 Dim con As OleDbConnection Dim cmd As OleDbCommand
[CODE]...............
The insertion part of the form works great. But my problem is in the form load part......If i leave a field blank(Null),then perform Save operation,close the form after successful insertion and then reopen the form,then it retains the previous values during the form load......This is only in case where i leave a field blank in the previous data entry in the database.......But if i enter values in all fields then form load is working great.
How hard would it be to graph a curve of a function in a VB form.
Attached is a graph from excel which is exactly what I need to do.
I have the function of some fluid properties and I'd like to choose a min and max temp then have the function graphed, with temp as the x and the fluid property as the y which would auto scale to fit the curve.
Actually now the program i have to return the properties at one temp is just a GUI front end to call a fortran program to return the properties so actually if I just use that it'd be graphing points and not directly from the function. I can always make it completely VB based if graphing from a function is easier than points. It'd be a slight pain to rewrite all the code for the functions though.
using vs2008 I am trying to create a line graph using vb in a windows form. I have dragged a chart onto the form, and via the properties window, through the series option have changed the type to the graph that I want, which is line. But all the time the data is displayed as a simple bar chart. How do I remedy this please to get the type of chart that I want.
I am doing some graphics work like Paint event, but I found a problem that the form will flash again and again whenever I call the method IRefresh() or Invalidate(). What can I do if I want to update a graph continuously but not causing the form to flash?
how to draw in vb.net, and I figured the easiest way is to get my hands dirty and start coding. I figure that the best way to start is by drawing a line on the form. What I'm trying to do is use the graphics.drawline(), but I'm failing. This is what I'm using so far
1)Interestingly, if I try to draw on a Form with formborderstyle = none, no drawing appears.On a form, with borders; no problem
2)If I draw from wihin a paint event, i can draw on both.However, the paint event has its own issues, most irritatingly the fact that it doesn't draw immedately, but only after going all the way back through a whole chain of calls.anyway that I can draw directly on a borderless form?
i have the blow code that draws forms border with custom color and title.
'A form with custom border and title bar. 'Some functions, such as resize the window via mouse, are not implemented yet. Public Class CustomBorderColorForm