Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Drawing Line In Excel


how i can draw lines in excel using vb




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
.circle And .line Drawing In Excel
Hi,

I'm normally not a Excel VBA coder. I looked up Drawing, Circle, and Line in the repository and found mostly references to Shape objects being used on a worksheet. Is that my only drawing option in Excel? I was hoping for someway to put a standard picturebox on my Excel Userform.

I'm looking for the basic Circle and Line drawing methods I'm familiar with.

~T

Line Drawing Again
Dear all,

Using VB6, I'm doing a project which i need to connect 1 object to another
object on the form itself via line. The line is created by MouseDown near the
starting object to MouseUp near the target object. Well, i need some improvements
for what i'm doing now as below:

1) How can i draw the line in which when i move the mouse after MouseDown,
the line is drawn on the form following MouseMove until MouseUp? Currently,
my project's line only appears after MouseUp.

2) My project's lines look ugly when it's drawn diagonally. Any way to make the line
looks better/smoother? Or, is there any way which i can draw "connector tool"
which is usually used in Ms Visio instead of using line control in VB?
Arrow may be a good idea too.

Drawing A Line
Hello,

I have a form and the following simple code:

Private Sub Form_Load()
Me.Line (100, 100)-(500, 500), RGB(0, 0, 255)
End Sub

But no line appears on the form on running.

Can anyone tell the reason for no lines appearing on the form?

Thanks in advance,
Anuj

Drawing 3D Line
Hi!

I would like to use 3D line in my project. Because Visual Basic doesn't support it, I draw two line controls 15 twips apart and set the top (or left) bordercolor to vb3dhighlight and the bottom (or right) to vb3dshadow.

This works fine, but is quite time-consuming when I want to move the line. Is there an easier way? (I know I could construct custom control, but I'm a newbie and don't know how to do it, so I would prefer some other method if possible)


Bostjan

Line Not Drawing... Help?
Alright, so I have a program that draws trapezoidal sections with no problem, and now I'm attempting to draw some lines within them. Here's the code


Code:
picMembers.Line (gLeft - (gWidthLower - gWidth) / 4, gTop + gHeight / 2)-(gLeft + 0.4333 * gWidth / 2, gTop + gHeight / 2)
picMembers.Line (gLeft, gTop)-(gLeft + 0.4333 * gWidth / 2, gTop + gHeight / 2)
picMembers.Line (gLeft + 0.7833 * gWidth, gTop + gHeight / 2)-(gLeft + gWidth + (gWidthLower - gWidth) / 4, gTop + gHeight / 2)
picMembers.Line (gLeft + gWidth, gTop)-(gLeft + gWidth + (gWidthLower - gWidth) / 4, gTop + gHeight / 2)

The first three lines get drawn no problem, but the last one draws nothing and I can't figure out why.

gLeft,gTop is the top left coordinate of the trapezoid. gWidth is the upper trapezoid width. gWidthlower is the lower width. gHeight is the height of the trapezoid.

Any ideas why this isn't working?

Line Drawing
i've transfered some code from c++ to VB that should draw a line without using a line function (pixel by pixel).
it works , but only in the 4th quadrant, can anyone make it work in al quadrants/octants. it's strange becouse i thought it would work in 1 octant only/ not work / work. but it works 1 quadrant so that means it will draw lines with slopes below 1 and higher than 1. anyway, here's the code:


Function test(ByVal x1 As Integer, ByVal y1 As Integer, ByVal x2 As Integer, ByVal y2 As Integer) As Integer

Dim DeltaX, DeltaY, X, Y, Xinc1, Xinc2, Yinc1, Yinc2 As Integer
Dim num, den, numadd, numpixels, curpixel As Integer


DeltaX = x2 - x1
DeltaY = y2 - y1
X = x1
Y = y1

If x2 >= x1 Then
Xinc1 = 1
Xinc2 = 1
Else
Xinc1 = -1
Xinc2 = -1
End If

If y2 >= y1 Then
Yinc1 = 1
Yinc2 = 1
Else
Yinc1 = -1
Yinc2 = -1
End If

If DeltaX >= DeltaY Then
Xinc1 = 0
Yinc2 = 0
den = DeltaX
num = DeltaX / 2
numadd = DeltaY
numpixels = DeltaX
Else
Xinc2 = 0
Yinc1 = 0
den = DeltaY
num = DeltaY / 2
numadd = DeltaX
numpixels = DeltaY
End If

For curpixel = 0 To numpixels
PSet (X, Y)
num = num + numadd
If num >= den Then
num = num - den
X = X + Xinc1
Y = Y + Yinc1
End If
X = X + Xinc2
Y = Y + Yinc2
Next curpixel

End Function

Line Drawing
Hi,

i was wondering if i could get some pointers on 2d line drawing.

Currently, i can click the mouse and move it to another point on the form and then click again. The line will draw itself, but i cannot see the line moving.

How do i make it so when i click the form (point x1,y1) , and then move the mouse i can see the line, and then when i click the form again it draws the line (point x2,y2)?

thanks.

Drawing A Line
I have an assignment that I am needing help with. Here is the problem, I have to compute the least squares best straight line fit to the points and plot both of them.
We were given the points in a dat file and their are 9 of them.
Here is the formulas we were given to work with:

dist=ABS(m8x0+b-y0)/SQR(m*m+1)

To fit the data points to a straight line we are supossed to use this:
For i = 1 to n
sx=sx+x(1)
sy=sy+x(1)
sx2=sx2+x(i)^2
sxy-sxy+x(i)*y(i)
Next
We were also given the coefficients to the m and b. can anyone please, please help or point me in a direction? Thanks

Drawing A Line
Hi,
I have the following code to draw a line on aform ..but it doesnt work ?


VB Code:
Private Sub DrawLine()  Dim bit As Bitmap = New Bitmap(Me.Width, Me.Height)  Dim g As Graphics = Graphics.FromImage(bit)  Dim myPen As Pen = New Pen(Color.Blue, 3)  Me.CreateGraphics.DrawLine(myPen, 100, 100, Me.Width, Me.Height)   End Sub

Drawing Line!!!
how to draw line when the mouse press and move in the picture control area? (or should use any other text control).

Line Drawing In VB6
I am completerly new to graphics. I have a very simple question but I haven't been able to locate an answer and most of the books seem to assume I already know the answer. I have a file of datapoints I am trying to plot on a picturebox. I can plot just fine, however, it draws a line form some point off the screen to the first point, then it plots the other points fine. When it si done, it deaws a line to the next set of points... My question is, How do I turn off the line drawing when I want to move the pen to a new location?

jldortch

Drawing A Line
Does anybody know how to draw a line on a form. Not your standard line, but a line that looks like it is indented, sort of like what the border of frame looks like.

Drawing Line
Hi everyone outthere,

This might be a stupid question for many of u. But since I am learning I encountered this difficulty. I want to draw a line when I click on form upto the other point where I click next. ie from first point to next point where mouse is clicked. Can anyone help me please

Thanks


arv

Drawing A Line
Hi
I wonder if anyone could perhaps please help me with a college project

I have a form named frmoperator
on the onformload event i need to draw four lines basically to draw a rectangle.

I have been told the co-ordinates as follows

line1 x1 = 1275
x2 = 1275
y1 = 1875
y2 = 75

line 2 x1=0
x2 =1275
y1 = 75
y2 =75


line 3 x1 = 0
x2 = 0
y1 = 1875
y2 = 75


line 4 x1 = 1275
x2 = 0
y1 = 1875
y2 = 1875


I have been told to set the froms auto redraw property to true


i wonder if anyone could perhaps point me in the right direction
also do i need to secify a colour



Many thanks in advance

Andrew

Drawing A Line =)
Anyone have any code to draw a line on another window.
It would need to take the following values...

DrawLineOnWindow(hWnd as long, x1 as long, y1 as long,
x2 as long, y2 as long, width as byte)

Can anyone do this for me please? If you have any
questions... ask away!

Line Drawing
I'm new to VB and I'm having a lot of problem trying to draw some simple lines... Can anyone help me with the following?

I want to be able to draw lines on a form with the following specification:
When I click on the form and move the mouse around, a broken line will appear following the cursor until I click at somewhere else on the form again, then a true line will appear. And when I move the cursor around again, the process will repeat (a broken line appears from where I last clicked to my cursor). This will only end when my last click matches the position of the first click, ie drawing a closed area. The following conditions should apply:
1) Once I click on the form and start drawing, the cursor movement will be limited to the form, ie I can't bring the cursor out of the form area, until the last click position matches the first click position.
2) Only vertical, horizontal and diagonal lines at 45 degrees can be drawn.
3) the lines cannot cross each other (ie, a true line won't be drawn if the line intersects with nother line).

I'm not sure if this is hard to do for you experts, but I spent so much time on it and it just wouldn't work...
HELP~~!

Drawing A Line
I am trying to make a basic shape drawing utility on my prog.

Currently it's for darwing a triangle.

The user puts in the 3 sides(lengths) and they are drawn on a form.

All I have done so far is Drawn 3 lines on a form and match there length labels to the text input from the user. To adjust the lengths of the lines I assume I need to work off some kind of scale.
Right now I have this for side A:

Line1.y1 = txtSideA.text
line1.y2 = txtSideA.text

obviously this is no good

Any tips? Ideas on a scale?

Thanks Much!

Drawing A Line
Hey fellers,

I want to draw a line in a picture box. How do I do it!?!?! I could use the SetPixelV API call but surely there's an easier way to do it. Is there an in-built function that can just draw a line from (4,40) to (20,80) for instance?

Cheers in advance,

Sam

Drawing Line
I want to draw/box a line on a tiff image pasted on a imgedit.ocx control. I am looking for help regarding this.

Drawing Line
I want to draw/box a line on a tiff image pasted on a imgedit.ocx control. I am looking for help regarding this.

Line - Drawing
Here is the scenario, I have an MDI project containing several child forms,
each of which has a picture box showing a video clip, I need to be able to
draw lines & circles on the video clip, just for display (I don't need to
save the result)

Can anyone help??

Many Thanks

Line Drawing
Hi,

I am having problems with line drawing in my report. I have a report with lines on it to create a table . After loading the data I added another detail to close the box. When data is more than a page it forces it to a new page. Is it possible to put a line across the bottom to close the box on the first page and place a line on the top of the second page?

Hope you can help me.

Drawing A Line In A RichTextBox
I'd like to have a vertical line in a richtextbox which will indicate that a certain # of characters have been reached. I've tried the line tool but that wont move to the front, therefore it can't be seen at run-time.

Any suggestions?

Thanks,
Bernie

Drawing Smoothed Line
Is it possible to draw a smoothed line with standart GDI methods and without using any images? Is it possible at all?
Does anybody have an example of such method?
Thanks.

Drawing A Line... Easy?
Just for curiosity... does anyone know the formula for drawing a line from (x1,y1) to (x2,y2)?
Without using Line(), obviously, only using PSet or similar...
Thanx!

Problem With Drawing A Line
I have this code:

Const START_X = 20

Printer.Line (START_X, START_Y + (frmMain.Shape1.height - 100) / 2)-(START_X + 300, START_Y + (frmMain.Shape1.height - 100) / 2)

It is meant for drawing a horizontal line. But the problem is, it does not come out on my printed form! It occurs after I changed the START_X. Initially START_X is at 800. What could be the problem?

Line Drawing Error
Hello. I'm attempting to redraw a line using user defined lengths, but I'm getting an error when I try to run the program. The error is a compiler error, "Wrong number of arguments or invalid property assignment."

And for the life of me I can't figure out why. Here's the method that's causing this error.


Code:
Private Sub cmdRedraw_Click()
Dim alpha As Double
Dim count As Single
Dim pixperfoot As Single
Dim xArray(0 To 4) As Single
Dim yArray(0 To 4) As Single
Dim colourArray(0 To 3) As Long
count = 0
alpha = Atn(200 / 1700)
colourArray(0) = vbBlack
colourArray(1) = &H404080
colourArray(2) = &H4040&
colourArray(3) = &H404000
Ypixperfoot = gsngPanelHt(gintCurrNode) / 1700
If cmbSecSect.Text = "1" Then
For i = 0 To 3
count = count + CSng(txtSect(i).Text)
Next
If count <> gsngPanelHt(gintCurrNode) Then
MsgBox "The panel section heights do not add up to the panel height.", vbOKOnly
txtSect(0).SetFocus
Exit Sub
Else
For i = 0 To 3
gsngPanelSectHt(gintCurrNode, i + 1) = CSng(txtSect(i).Text)
Next
picElevView.Cls
picElevView.DrawWidth = 3
xArray(0) = 500
yArray(0) = 2000
For i = 1 To 4
yArray(i) = yArray(i - 1) + (Ypixperfoot * CSng(txtSect(i - 1)))
xArray(i) = xArray(i - 1) - yArray(i) * Tan(alpha)
picElevView.ForeColor = colourArray(i - 1)
picElevView.Line (xArray(i - 1), yArray(i - 1))-(xArray(i), yArray(i))
Next
End If
End If
End Sub

the picElevView.Line command is the one that causes the error, and yet it's written in the required .Line (x1,y1)-(x2,y2) syntax.

Any idea why this isn't working?

Drawing A Line - Question
Hello, i have successfully drawn a line into a picture box, but i would like to be able to draw the line over my whole screen, and i already have it on a timer to make sure it stays there no matter if you refresh screen etc.


Code:
Dim DummyPt As PointAPI
Picture1.ForeColor = vbBlue
Call MoveToEx(Picture1.hdc, 5, 120, DummyPt)
Call LineTo(Picture1.hdc, 5, 10)
This is the code i have currently, plus in the declarations to help it along. Would anyone be able to assist me in making this line get drawn over everything on my screen & be transparent. Thanks for any help =D.

Line Drawing Algorithm
hi,

i was wondering what is the equivalent expression in vb of this C++ code if anyone knows?


Code:

for (x=x0; x<=x1; x++){
writepixel(x,(int)floor(y+0.5))
y+=m
}
i am going to use Pset instead of writepixel. What is floor?

thanks!

Line (of Tiles) Drawing
I've the got the following code to draw a line of tiles based on the line generated by the MouseDown, MouseMove, and MouseUp events for the destination PictureBox (picMap). So in MouseDown I store (x1, y1) and in MouseUp I store the final (x2, y2). I then try to cycle through each pixel on the line segment between these two points, determine which 32x32 pixel tile they lie within, and add that tile (by Row and Col location, not pixel) into my array, lineTiles. Once I've gone through all the pixels on the line, I go through lineTiles and for each tile I BitBlt the appropriate tile to that destination, then update the index stored in my 2D array representation of the Map with Map.SetIndex. The code is identifying the wrong tiles as being intersected by the line though and I'm pretty much fried by now trying to get it to work. I'm just hoping someone else can take a fresh look and see any glaring logic error.


Code:
Const ROWELEM = 0
Const COLELEM = 1

Dim testX%, highX%, highY%, lowX%, lowY%, testY%, m%, b%
Dim testRow%, testCol%, r%, c%, lineTiles%()
Dim lowRow%, lowCol%, highRow%, highCol%
Dim destX%, destY%
Dim tileFound As Boolean

' Determine if x1 (Map.DownX) or x2 (Map.UpX) is largest
If Map.DownX >= Map.UpX Then
' x1 (Map.DownX) is largest
highX = Map.DownX
highY = Map.DownY
lowX = Map.UpX
lowY = Map.UpY
Else
' x2 (Map.UpX) is largest
highX = Map.UpX
highY = Map.UpY
lowX = Map.DownX
lowY = Map.DownY
End If

' Drawing mode is LINE
If dMode = LINEMODE Then
' Store first and last tiles in lineTiles
' lineTiles(ROWELEM/COLELEM, TILENUM)
ReDim lineTiles(1, 1)
testRow = (Map.DownY 32) + 1
testCol = (Map.DownX 32) + 1
lineTiles(ROWELEM, 0) = testRow
lineTiles(COLELEM, 0) = testCol
Debug.Print "testRow[" & CStr(testRow) & "] and testCol[" & CStr(testCol) & "] stored in slot[0]"
testRow = (Map.UpY 32) + 1
testCol = (Map.UpX 32) + 1
lineTiles(ROWELEM, 1) = testRow
lineTiles(COLELEM, 1) = testCol
Debug.Print "testRow[" & CStr(testRow) & "] and testCol[" & CStr(testCol) & "] stored in slot[1]"

' Find slope (m) and y-intercept (b)
If Map.UpX <> Map.DownX Then
' Line is not vertical
m = (Map.UpY - Map.DownY) (Map.UpX - Map.DownX)
End If
b = Map.UpY - (m * Map.UpX)

' Determine which x-coordinate is larger
If Map.UpX >= Map.DownX Then
highX = Map.UpX
lowX = Map.DownX
Else
highX = Map.DownX
lowX = Map.UpX
End If

If Map.UpX <> Map.DownX Then
' Line is not vertical
' Scan for tiles intersected by the line
For testX = lowX + 1 To highX - 1
' Determine y-coordinate
testY = (m * testX) + b
' Determine Row and Col (user-friendly) position of tile
testRow = (testY 32) + 1
testCol = (testX 32) + 1

' Check if this tile has already been updated
tileFound = False
c = 0
Do Until tileFound = True Or c > UBound(lineTiles, 2)
If (lineTiles(ROWELEM, c) = testRow) And (lineTiles(COLELEM, c) = testCol) Then
' Tile has already been updated
tileFound = True
End If
c = c + 1
Loop

' If this tile has not yet been updated
If Not tileFound Then
' Add tile row/col to arrays
Debug.Print "testRow[" & CStr(testRow) & "] and testCol[" & CStr(testCol) & "] stored in slot[" & CStr(UBound(lineTiles, 2) + 1) & "]"
ReDim Preserve lineTiles(1, UBound(lineTiles, 2) + 1)
lineTiles(ROWELEM, UBound(lineTiles, 2)) = testRow
lineTiles(COLELEM, UBound(lineTiles, 2)) = testCol
End If

' Allow for external processing
If GetInputState Then
DoEvents
End If
Next testX
' End tile intersection scan

' Fill all the tiles in lineTiles
For c = 0 To UBound(lineTiles, 2)
' Make sure lineTiles(,c) lies within the actual Map (which can be smaller than picMap)
If (lineTiles(ROWELEM, c) < Map.GetRows) And (lineTiles(COLELEM, c) < Map.GetCols) Then
' lineTiles(,c) lies within the actual Map
' Determine destination pixel coordinates
destX = (lineTiles(COLELEM, c) - 1) * 32
destY = (lineTiles(ROWELEM, c) - 1) * 32
' Select the source tile (Fore, Back, Base)
Select Case bMode
Case FORETILE
' Copy source tile to destination tile
BitBlt picMap.hdc, destX, destY, 32, 32, picFore.hdc, 0, 0, vbSrcCopy
' Update 2D Map Index array
Map.SetIndex lineTiles(ROWELEM, c) - 1, lineTiles(COLELEM, c) - 1, Brush(FORETILE).TileIndex
Case BACKTILE
' Copy source tile to destination tile
BitBlt picMap.hdc, destX, destY, 32, 32, picBack.hdc, 0, 0, vbSrcCopy
' Update 2D Map Index array
Map.SetIndex lineTiles(ROWELEM, c) - 1, lineTiles(COLELEM, c) - 1, Brush(BACKTILE).TileIndex
Case BASETILE
' Copy source tile to destination tile
BitBlt picMap.hdc, destX, destY, 32, 32, picBase.hdc, 0, 0, vbSrcCopy
' Update 2D Map Index array
Map.SetIndex lineTiles(ROWELEM, c) - 1, lineTiles(COLELEM, c) - 1, Brush(BASETILE).TileIndex
End Select
End If

' Allow for external processing
If GetInputState Then
DoEvents
End If
Next c
' End tile fill

' Release lineTiles memory
Erase lineTiles
Else
I use this function to draw vertical lines and boxes as well, but I'm not worried about those right now. That code is what follows the last Else though, if you were wondering. If this code segment seems insufficient or you want to just play around with the code for yourself, I'm attaching the project in a ZIP.

PS-If you grab the project for testing, create a new map, or open the test.mtm map.

Drawing Contour Line
I am preparing for my presentation and want to hear some tips from you guys. I got the contour lines drawn in VB (in a picturebox). My question is to how to put it in Powerpoint. Do I have to redraw the contour line in powerpoint? Any suggestion would be appreciated.

Line Drawing Problems
I am trying to draw grahic lines (boxes) to the printer.
When designing this code, I get the desired effect when drawn to the form, but when this same code is sent to the printer, I get different results.

Here is a sample of the basic idea. This is the graphic Line command executed at runtime.

Form1.Line(1,1)-(100,100),,B
Form1.Line(1,1)-(500,500),,B

This code shows 2 boxes when drawn to Form1, but only 1 box when sent to the printer as follows.


Printer.Line(1,1)-(100,100),,B
Printer.Line(1,1)-(500,500),,B

This code shows only 1 box on the printer. The second box (1,1 to 500,500) covers the first box.

If I reverse it, both boxes show.

Printer.Line(1,1)-(500,500)
Printer.Line(1,1)-(100,100)

How can I get the background box to continue to show through the second foreground box when printed.

Simple Line Drawing...
I'm new to VB and I'm having a lot of problem with it...
I can draw simple line using form_mouseup and form_mousedown commands as the following:

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Form1.CurrentX = X
Form1.CurrentY = Y
End Sub

Private Sub Form_Mouseup(Button As Integer, Shift As Integer, X As Single, Y As Single)
Line (CurrentX, CurrentY)-(X, Y)
End Sub

But what I want to do is actually like this:
When I first click on the form and move the mouse around, a broken line will appear from the first click point to my mouse cursor, until I click on somewhere else on the form again then a true line will appear. When I move the cursor around again, another broken line will appear from the point when I last clicked to the cursor. This should continue until my last click matches the first click (same point). The 2 conditions are that the lines must not intersect and I can ony draw horizontal and vertical lines, not diagonal ones.

Can anyone help me? I've been trying to work out for the whole morning...

Drawing Line Using PSet
Hey, I want to know how to draw a line using PSet, there is a reason I am using PSet to draw a line. I attempted it... But the script I made doesn't quite work.


Code:
Private Sub Command1_Click()
Dim gradient As Double
Dim x1 As Long
Dim y1 As Long
gradient = getGradient(txtX1, txtY1, txtX2, txtY2)
If gradient > 1 Then
gradient = 1 / gradient
For y1 = txtY1 - 1 To txtY2 - 1
Form1.PSet (gradient * y1, y1), 0
Next
Else
For x1 = txtX1 - 1 To txtX2 - 1
Form1.PSet (x1, gradient * x1), 0
Next
End If
End Sub
Function getGradient(x1 As Integer, y1 As Integer, x2 As Integer, y2 As Integer) As Double
getGradient = (x1 - x2) / (y1 - y2)
End Function

Drawing The Line Of Diagonal
Welcome all

I have such code, which to draw the line from Y1 to up


VB Code:
Private Sub cmdUp_Click()    intFart = intFart + 1    Set NewLine = Me.Controls.Add("VB.Line", "Line" & CStr(intFart))    NewLine.X1 = iX    NewLine.Y1 = iY    NewLine.Y2 = iY    NewLine.X2 = iX    NewLine.Y2 = NewLine.Y1 - CLng(Text1.Text)    NewLine.Visible = True    iY = NewLine.Y2    iX = NewLine.X2End Sub

If will be to change this line of code:


VB Code:
NewLine.Y2 = NewLine.Y1 - CLng(Text1.Text)


I can change direction of draw.

It fine works, but i want to draw a diagonal line under angle of 45 degrees, how to make, i donít know.

someone help me this?
thx in advance

Drawing A Line In A Picture Box
I assume to draw a line in a picture you use the .Line function. I have 2 options for the user to view the certain spot on the picturebox as either a circle drawn around the spot of as 2 line intercepting eachother. I got the circle drawn like this: Picture.Circle (X, Y), 1.8, vbRed but I don't what the syntax is for drawing a line. Can someone help me?

Need Help For Drawing Line On Picture Box
I have the following code for drawing a line on form......can any one help me for drawing a line on picture box using the same following code.for information I faced the problem because Picture box has no Load options....
====================================



VB Code:
general declerationDim cx1, cx2, cy1, cy2, m1, m2 As IntegerDim line1 As BooleanPrivate Sub Form_Load()DrawWidth = 1                              ' Use wider brush.     ForeColor = RGB(255, 0, 0)             ' Set drawing color.Refresh End Sub Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)Screen.MousePointer = vbCrosshair     'Changing the mouse pointer to Crosshair      line1 = True                        ' Start Drawing the line      cx1 = X                        ' Set to X1 Co-ordinate point where 'Userpoints      cy1 = Y                        ' Set to Y1 Co-ordinate point where User 'points      PSet (cx1, cy1)     ' Line -(cx1, cy1)               ' Draw the starting point of the line     End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)If line1 = True ThenRefreshcx2 = Xcy2 = Ym1 = (cx1 + cx1) / 2m2 = (cy1 + cy2) / 2Line (cx1, cy1)-(m1, m2)'Line (m1, m2)-(m1, Y)Line (m1, m2)-(X, m2)Line (X, m2)-(X, Y)End IfEnd SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)line1 = FalseEnd Sub

Drawing A Curving Line
I want to draw a line to show the path of a projectile on a projectile physics calculator I have made. The only problem is I have absolutely no clue how to start. Anyone have some tips on where to start.

Thanks, Tanner

Drawing A Line And Bending It
Ok im just want to make this program for a reason, which im not telling you.
I wanna make a horizontal scroller then make a code where whenever the hor. scroller is scrolled to the left, we code a line and make it bend whenever the hor. scroller move to the right, and when the scrolle move to the left again the line will be straight and not bend

BUT THE MORE THE HOR. SCROLLER IS MOVED TO THE LEFT, THE MORE THE LINE WILL BEND.

What is the code for this?

THANKS IN ADVANCE.

Drawing A Line Over An OCX Control
I have placed an OCX control on my form, and would like to draw some arrows on it. The problem is whenever i draw a line it goes into a seperate layer, and will therefore remain below the control (even when I use the 'send to back' option for the control).

How can I manipulate VB's layering so that the line will appear above the control?

Thanks!

Line Drawing Control
Does anyone Know of good control to draw Lines??
For example I want to add a bunch of points and have it draw connecting lines.

Drawing A Line In A Picture Box
This is what im trying to do.....Basically i need an x and a y axis centered in a picture box my scale width and height are both 100.

code im trying

Picture1.Line (0, 50)-(100, 50), vbBlack

and i have tried just puting lines on the picture box and tried to manipulate the coordinates but nothing happes can someone help me with this pls.....

Drawing Line In A Picture
I want to draw lines in a picture using mouse such that when I press the mouse button the line starts and when I release the button, the line finishes at that point. This is just like drawing lines on a form at design time but I want to do the same at run time. The program should draw as many lines as i wish.

Does anyone know the solution to it? Please explain me how to do it.


Thanks.

Simple Line Drawing Help
I figured out how to draw freehand...however, I am having some issues on how to draw other pen objects.

I need to have a user draw on a picturebox a line with an arrow on the end of the line.  The other object will be a line that ends with a "T".  In addition, I need an option for them to have a solid line or a dashed line.  These are not straight lines, for they need to be able to have a degree bend in them if needed.

I also need to have the user have the capability to delete these objects while they are drawing (one at a time)...just incase they make a mistake.

Reading MS website was like reading greek...it would only take me so far then hang me out to dry on the finished product

Any suggestions would be great!

DirectX Line Drawing
Hi,

I'm trying to draw a line in DirectX and am having problems.

I try to draw the line with....

LineData(0) = CreateTLVertex(100, 1000, 0, 1, 0, 0, 0, 0)
LineData(1) = CreateTLVertex(100, 100, 0, 1, 0, 0, 0, 0)
    
D3DDevice.DrawPrimitiveUP D3DPT_LINELIST, 1, LineData(0), Len(LineData(0))

But the line does not show.

It seems to be something to do with the line width.

If I change the coords to...

LineData(0) = CreateTLVertex(100, 1000, 0, 1, 0, 0, 0, 0)
LineData(1) = CreateTLVertex(101, 100, 0, 1, 0, 0, 0, 0)

Then it draws the line, but if I move around the coords to different parts of the screen, the thinkness of the line changes slightly depending on where on the screen it is, sometimes makaing it have no width and therefor invisible...

Cant believe its this hard to draw a line!!!

Thanks for any help,

Rob D. ProIV Resource Centre www.proivrc.com

Drawing Line Over Top Of A Control
How can I draw a line over the top of a control? If it was a picture box I would just use the Line function which is part of that control but this control doesn't have that function.


Remember to use [code=vb][/code] tags around code.
| Posting rules | How to get your questions answered | Wonko's Blog | Twerps Peerage |
vbCity Recent Topics RSS feed

Need Help In Drawing Line Chart
i had write a program using MSFlexGrid to show the result of a calculation,but i dun know how to create a line chart from the result..is there anyone can help??thanks a lot for ur kindly attention..i will attach my code in the attachment..the "calculation" button can function but the "draw" button cannot function..i think the code that i put there is not accurate..i m quite new in vb programming...



Edited by - Kelly80 on 4/6/2004 6:24:44 AM

Drawing Circle,arc, Or Line
Can anybody show me or provide links on some tutorial that explain how to draw circle, arc, or line in picturebox using VB6, including explain how or what these codes is defined. Perhaps you could explain me on next post if you can help. You help is appreicated

Drawing Line To A Form
How the heck do you draw lines and circles in VBA????, or does anybody have something like a canvas control????

_ _ Quiting Smoking is easy,Hell,
 ^ I've done it at least 16 times..

Copyright © 2005-08 www.BigResource.com, All rights reserved