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)
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
This is more of a mathematical problem than programming problem.I have created a very basic 3D engine using Visual Basic .Net. It displays lines on the screen with an additional z axis. The engine works, however when part of the line goes below 0 it messes up and starts drawing the line inverted again.
This is how it calculates the points:
y = (point.y / z) + offset.y + camera.y x = (point.x / z) + offset.x + camera.x
Can anyone work out a way to only draw part of the line when it intersects the z=0 axis?
In VB6 I used some pattern of programming..I passed the picturebox as parameter to some procedure in some class and inside this procedure paint all needed graphics using this class methods.Now I want upgrade my application to vb.netBut all samples for line drawing show me how to draw inside paint event.[code]
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
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] .....
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
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).
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.
I have 1 image in picturebox. Now I draw some rectangles. I'm trying clear the image (only rectangles and left the image) without success.
Private Sub btnImageSelection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImageSelection.Click Dim intImages As Integer = 0 Dim intImagesLine As Integer = 0 Dim intImagesColune As Integer = 0 picImage.Image = PictureBox1.Image [Code] .....
The cycles for is for show the rectangules and works fine. but i.Clear(Color.Blue) The image is clear but the rectangles are showed and then unshowed.
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'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
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
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.
Problem1: I have a picturebox on a form. I have also managed to draw several PNG files with transparency onto the picturebox (see below). However, If I move the form outside the border and move it back, the image is gone. My source so far:
Dim k1 As New Bitmap(My.Resources.image1) Dim k2 As New Bitmap(My.Resources.image2) Dim drawMe As Graphics = PictureBox1.CreateGraphics Dim bgcolor As Color = Color.FromArgb(128, 128, 128) drawMe.Clear(bgcolor)
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:
Dim Gr As Graphics = SomePanel.CreateGraphics() Gr.Drawline(StartingPoint, EndingPoint)
I want to be able to have a line drawn from point a to b, but be able to rate it 90 degress based on user input so if the user inputs 70 I want it to rotate 30 degree's to simulate a 70 deg relationship to a horizontal line that it touches if that makes any sense. a is starting point b is the user inputs 70 and it draws it at 70 in relationship to the horizontal lineheres the image that i forgot to post above Attached image(s)
I was wondering if anyone could steer me to any good references to using OpenGL in vb.Net? I wanted to try a simple line drawing test to start off with, and came across many old discussions about using CsGl or the Tao Framework. But I could not get CsGL to import into Net2008 (the Add Reference window simply could not see the DLL that was clearly there when using Windows Explorer). And although I could get Tao to import OK, and found portions of one person's project, I figured that somehow the GL window he was referring to had to first be set up as a GL object (new class?).In addition, all the OpenGL books I have looked at only discuss OGL with respect to some version of C.From what I have gathered, you need a connector between vb.Net and the opengl32.dll libraries and that is what CsGL and Tao are about. But the edumucation resources seem very few.
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
I have a question about drawing lines. Most of the code snippets I've seen approach drawing a line with the mouse down as the startpoint and the mouse up as the endpoint. But I am trying to draw a line by startpoint as a mouse click and then an endpoint as a mouse click just as you do on a typical cad program.
That's vertical and 1 pixel wide. This is for a mulitiprocessor performance monitor.How do I do it....if you tell me which routine to use... I'll take it from there. I don't think the routine is
System.Drawing.Graphics.DrawLine, because it's looks to an external reference like I'm putting random pixels in.If possible I need to put the pixels in by hand. Besides this line of pixeld is another line of pixels for another epoch. They are not related numrically.
I am doing a project with graph (VB.NET). I am drawing a line handling dynamic property ( opacity changes based on DB value). I don't know how to change the opacity.