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




Stop A Moving Image Drawing Over Other Lines...


I have the following code which moves a little image control across the form, but what happens when it moves across slowly is it sort of half draws over lines that I have on the form....how can i get it so that it doesnt draw over the other lines and leaves them intact....so that it doesnt leave this kind of trail.....


VB Code:
Private Sub Timer1_Timer()If Image2.Left < 9240 Then Image2.Left = Image2.Left + 1'only move the picture one space over if it isnt alreadt at the desired locationEnd IfEnd Sub




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Drawing Lines Behind Image
I have a image on my forum and during runtime I use the forum.line command to draw a line, but it draws it over the image and I would like it behind the image. Is there a way to do this?

Drawing Lines Using Image Editor Toolbar
Hi,

I need to draw a line on a windows form in my project using Visual
Basic .Net 2003. My preference would be to use a toolbar rather than
code, if possible. I was able draw lines on forms using Visual Basic
6.0 with no problem but now for some reason the line tools are grayed
out on the Image Editor toolbar in .Net 2003. Does anyone know if it
is possible to do this using a tool bar in Visual Studio .Net 2003 or
will I need to code it instead?
I have been seaching Technet, MSDN, and the Knowledge Base for 2
days and cannot find an answer.

Thanks,
Rob

Moving Lines In A Text Lines
I am creating a replay for a game and I am keeping the info for it in a text file but after 5 seconds I want to clear out anything over 5 seconds old and continue to add. I can figure most of it out cept for the whole part about it removing the first line and moving the rest of the lines up. I am adding to the file every 1/2 second for 5 seconds. Heres what I have so far....


VB Code:
Open "C:Game
eplay.txt" For Append As #1TotTime = Int(Timer) Print #1, Int(Timer); "lblbox(" & Index & ")"If Int(Timer) - TotTime = 5 Then


lol, not much but I can't figure out how do move the lines. Would I just kinda have a second file and copy the lines into the new file and just clear out the old one and so on? But that doesn't seem like an appropriate way to go. Any help with this situation would be muchly appreciated. Thank you and good day.

Drawing Lines
Hi i have been working on a virtual microscope. Attached is a picture of the project. When the user moves the curser to the right, for example, the image on the left moves to the right and so does the small square in the image on the right. In the picture you can see that a line has been drawn in the small image, this indicates where the user has moved. At the moment i can only seem to draw one line and this moves on the x axis. What i am trying to work out is how i get a new line to start where the old lines ends, i.e. when they change the direction on the microscope. Can anyone help me out?

Drawing Lines
Okey my GUI application is goin alright now. I made a pretty impressive textbox. But i'm stuck now on how to draw lines with DirectX. In the helpfile i found as much as what is explained about linestrips and line lists. I want to use a linestrip to draw a box around my textfield. Does any one know how to draw lines in DirectX. I tried just using the same as for triangle strip but that doesn't seem to work, no error but also nothing displayed:S. If anyone know the answer pls explain it by using drawPrimitiveUP. And can you specify the width etc of lines?
By the way what is the difference between this call and the more complex one everyone else is using(with opening pipes etc)??

Thx
Chokamir

I'm planning to have my GUI class finished soon, i'll post them here so other people can use them for there menu in games if they want.

Drawing Lines
Hi all,

I was just wondering if anyone knew how to draw a line on top of an image and how to draw the line at a certain angle and length.

I have a few dials on my form (all pictures with the needles removed from them) and what I am looking to do is have vb draw a line on the dial to represent the needle.

The center of the dial will be at the same coordinates in the image for each dial and the radius of each dial is the same. So what I am looking is to pass a function an angle (default will be a horizontal line) and the program to draw the line at the stated radius for that angle. Then if a different angle is passed the line to be redrawed at this angle.

Cheers

John

Help With Drawing 3 Lines
i can get it to draw a line and change colors but i want it to draw three lines when i click the button. here is what i have. i think that there is sometnig messed up with my loop.

Option Explicit

Private Sub Command1_Click()
Randomize Timer
Dim a As Integer
Dim x1 As Single, y1 As Single
Dim x2 As Single, y2 As Single
Dim x As Integer
Dim y As Integer
Dim z As Integer


x = (Rnd() * 255) + 1
y = (Rnd() * 255) + 1
z = (Rnd() * 255) + 1

x1 = Rnd() * Width
y1 = Rnd() * Height
x2 = Rnd() * Width
y2 = Rnd() * Height

a = 0
While a < 4
Line (x1, y1)-(x2, y2), RGB(x, y, z)
a = a + 1
Wend

End Sub

Drawing Lines
Allo. I have a box with labels listed vertically, and i'm wanting to have on the click event, a box drawn around the item to show it's selected and drawn down to the middle of the box. I've attached two pictures to show what I mean. Is there anyway I can drawn these lines on the click without drawing out all the possibilites in design time and just showing and hiding them when a certain item is selected?

Thanks for any help.

--Val

Drawing Lines
I have two questions:

1) I know if I use the built-in line drawing functionality care-of the toolbar I can create a line, change it's mode, and thus create, say, a dashed line or a solid line. How do I do this same thing when I code a line? ie Object.Line (X1,Y1) - (X2,Y2) and I want it to be a dashed line.

2) Is there any way to make a jagged line or squiggly line? If there isn't built-in styles for that, does anyone have any suggestions? FYI, the line I would need to be jagged would be basically user defined (through mouse clicks) from any beginning point to any ending point.

Thanks in advance for any help.

Drawing Lines
Hey peoples
i am a real amateur at vb so any help would be greatly appreciated.
Few Questions.

How would you draw a line in a picture box after selecting say option1 from an optionbutton?
i would like this line to start when clickin in the picturebox, and to finish on the second click.

i have looked at a couple algorithms and they look pretty complicated to me.

furthermore,

ive managed to do something more complex probably, i draw lines, which are continuing from the previous click, they only draw horizontal and vertical which is what i want. this is all in the picturebox again. but eventually i want to join these lines up, which i can, but i want to stop the lines from drawing(that is not allow anymore to be drawn) once i have joined them up say in a square rectangle or whatever.

thanks guys
Adam, Oz

Drawing Lines
I am looking for a fast way to draw some lines, right now i am using Form.Line to do it, but i would like some thing that would be a little faster, i might just end up using DirectX, but i would prefere to stay away from that.

Drawing Lines
how do i get it to draw say 500 vertical lines and 500 horizontal lines to the form when it loads, and have them as an array (one for horizontal and one for vertical) my teacher doesn't know so i come to yet again lol

thanks in advanced

Drawing Lines.
How would I go about drawing a line anywhere on the screen not the form, preferably without directx? could someone give me an example?

Drawing Lines
What method would I use to draw a simple line that is 1 pixel thick?

Drawing Lines
if you had 2 vertical lines a distance apart from each other, could be any distance but both y2 position are the same, how can you work out three more lines all the same size in length, one coming from the y2 position of the left line at 45 degrees, the other from the y2 position of the right line at 45 degrees and the third is flat meeting the two other lines just created, all 3 must be the same length. see attachment

did i explain it ok ?

thank you so much.

casey.

Drawing Lines
Hi,

Say if I have a line with coordinates:

(x1,y1)-(x2,y2)

This will have a beginning and an end point.

How can I have it so the line will continue on through these, points, forever, without stopping on the points? Just need it for a project I'm working on.

Thanks.

Drawing Lines
how could i draw a line over another activeX?

Drawing Lines
JUST STARTED FIRST ASSIGNMENT IN VB AND AM STUCK.

HAVE TO DRAW A LINE ON A PIC BOX GOING NORTH, SOUTH, EAST OR WEST WITH 3 COMMAND BUTTONS AND LABEL SHOWING DIRECTION (N,S,E,W)

1- FORWARD BUTTON
2- TURN LEFT
3 TURN RIGHT

DEFAULT IS 300 TWIPS PER CLICK

THE LINE STARTS AT BOTTOM, MIDDLE OF PICTURE BOX AND IS ALWAYS CONNECTED.


I HAVE BEEN ABLE TO MOVE AN IMAGE ROUND ON A PIC BOX (ALTHOUGH NOT ROTATING IT) WITH A CORRESPONDING DIRECTION IN A LABEL (N,S,E,W). THIS IMAGE MOVES 300 TWIPS WITH EACH CLICK. HOWEVER, I JUST CANNOT FIGURE OUT HOW TO DRAW A LINE THAT ACTS IN THE SAME WAY.

CAN ANYONE HELP ME, PLEASE???????????

KIND REGARDS

JAMES

Drawing Lines
What code can i use to draw a line from one point to another. All points would be connected therefore giving us one shape conected to another shape ect... The points would be located in a text file.

ie. 12,34
23,45
34,56
23,23
34,-2

Drawing Lines?????
I know how to draw lines well but what i want to do is draw a line that starts thick (wide) and ends thin. (Comes to a point like an arrow almost)

Any clues

Mark

Drawing Lines
Any body Please help me to draw line on form to actual measurements.

For eg.

I want to draw a line exactly 5 inches long with a left margin of 1 inch in a form. And when printed it should measure exactly 1 inch. How it is done.
Please help

vbbaby

Drawing AntiAlised Lines
I Want to draw anti aliased lines of different color...

Pls Help...

Drawing Smooth Lines
Hello All,

I'm working on a program that draws spirals and circles on a graph, much like a graphing calculator. Currently, I'm using a picture box as the drawing surface and the Line and PSet functions to draw my graphs. Speed is not an issue here but I was wondering if there was a way to draw the lines so that they look and print out looking smooth like a flash presentation. Are there any special drawing functions I could use to accomplish? Something from the API perhaps? I attached some sample output of my program so you can get a better idea of what I'm talking about. When the file prints out, it looks very pixilated when I want all the lines to come out smooth(er) then they are. Any help would much appreciated.

Jason O

Could Someone Please Help Drawing Simple Lines
I’m not sure how to explain my problem, except to say that some of
my straight lines that I am trying to draw aren’t so straight
so I set up a this project to use as an example. If anyone would
be kind enough, set up and run this project and follow the
caption of Label3 at the top of the picturebox to see my
explaination. If I set the Picture1.ScaleMode property to Pixel,
it seems to work fine. But I need the ScaleMode property set to
Twips so that I can later use two picture boxes and scrollbars
for a scrollable picture box.

Place these controls “any where any size” on Form1
The Form1 Load Event will set the position’s and properties of all the
Controls.

One Picturebox. Named Picture1
Three Textboxes. Named Text1, Text2 and Text3.
Four Labels. Named Label1, Label2, Label3 and Label4.
One Command Button. Named Command1
One more Label “placed inside of Picture1”. Named Label5.

Paste this code in the declarations of Form1.


Code:
Dim CurX, CurY, Mag, lnX1, lnY1, lnX2, lnY2, lnLength As Single
Dim Pi, Angle As Single
Dim Info As String
Dim InfoCounter As Integer


Private Sub Form_Load()
Pi = 3.14159265358979
Call Set_Position_And_Size_All_The_Controls_On_The_Form
End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
CurX = X: CurY = Y
Command1.Enabled = True
Call Set_Node
Call Explanation 'Show my dumb comments in Label3.Caption
End Sub

Sub Set_Line_Properties()
Dim SideA, SideB As Single

lnX1 = CurX: lnY1 = CurY: Mag = Text3.Text
lnLength = Mag * Text1.Text: Angle = Text2.Text

'I think this is where my problem is
SideA = Sin(Angle * Pi / 180) * lnLength
SideB = Cos(Angle * Pi / 180) * lnLength

Select Case Angle
Case 0
lnX2 = CurX
lnY2 = CurY - lnLength
Case 45
lnX2 = CurX + SideA
lnY2 = CurY - SideB
Case 90
lnX2 = CurX + lnLength
lnY2 = CurY
Case 135
lnX2 = CurX - (-SideA)
lnY2 = CurY + (-SideB)
Case 180
lnX2 = CurX
lnY2 = CurY + lnLength
Case 225
lnX2 = CurX + SideA
lnY2 = CurY - SideB
Case 270
lnX2 = CurX
lnY2 = CurY - lnLength
Case 315
lnX2 = CurX + SideA
lnY2 = CurY - SideB
Case 360
lnX2 = CurX - lnLength
lnY2 = CurY
Case Else
'How can I do other Angles here?
Exit Sub
End Select

CurX = lnX2: CurY = lnY2
Call Set_Node
End Sub

Private Sub Command1_Click()
Call Set_Line_Properties
Picture1.Line (lnX1, lnY1)-(lnX2, lnY2), vbBlue
Call Explanation 'Show my dumb comments in Label3.Caption
End Sub

Sub Set_Node()
'Sets a red node at CurX,CurY position
Label5.Width = 50: Label5.Height = 50
Label5.BackColor = &HFF&: Label5.Visible = False
Label5.Top = CurY - 15: Label5.Left = CurX - 15
Label5.Visible = True
End Sub


Sub Explanation()
'All my dumb comments shown in the Label3 Caption
InfoCounter = InfoCounter + 1
Select Case InfoCounter
Case 1
Info = "Click on the Picturebox to set the" _
& " CurX and the CurY for the starting" _
& " point of the line to be drawn"
Case 2
Info = "Notice the Angle value. The Line will be drawn" _
& " straight up. Press Draw Line Button"
Case 3
Info = "Notice the Angle value has changed to 45" _
& " Press Draw Line"
Text2.Text = 45
Case 4
Info = "Notice the Angle value has changed to 135" _
& " Press Draw Line again."
Text2.Text = 135
Case 5
Info = "Here is my problem. Why is this line not" _
& " straight? Press Draw Line again."
Text2.Text = 225
Case 6
Info = "This line is not straight either." _
& " Press Draw Line yet again."
Text2.Text = 315
Case 7
Info = "But this Line is straight. One more time and" _
& " I will shut up"
Case 8
Info = "I would appreciate any help I could get!!!"
Text2.Text = 45
Text1.Enabled = True: Text2.Enabled = True: Text3.Enabled = True
End Select

Label3.Caption = Info

End Sub
Sub Set_Position_And_Size_All_The_Controls_On_The_Form()
'Set's all the control properties
Form1.WindowState = 2

Picture1.Width = 5950: Picture1.Height = 4950
Picture1.Top = 800: Picture1.Left = 2150
Picture1.BackColor = &H80000009: Picture1.MousePointer = 2
Picture1.AutoRedraw = True: Picture1.ScaleMode = 1 'Twips

Text1.Left = 1275: Text1.Top = 1335
Text1.Width = 675: Text1.Height = 285
Text2.Left = 1275: Text2.Top = 1680
Text2.Width = 675: Text2.Height = 285
Text3.Left = 1275: Text3.Top = 2020
Text3.Width = 675: Text3.Height = 285
Text1.Text = 24: Text2.Text = 0: Text3.Text = 20
Text1.Enabled = False: Text2.Enabled = False: Text3.Enabled = False

Label1.Width = 900: Label1.Height = 270
Label1.Top = 1385: Label1.Left = 265
Label2.Width = 900: Label2.Height = 270
Label2.Top = 1720: Label2.Left = 265
Label3.AutoSize = True: Label3.ForeColor = &HFF0000
Label3.FontSize = 10
Label3.Left = 265: Label3.Top = 325
Call Explanation
Label1.Caption = "Line Length": Label2.Caption = "Angle"
Label4.Width = 900: Label4.Height = 270
Label4.Top = 2115: Label4.Left = 265
Label4.Caption = "Mag"
Label5.Visible = False

Command1.Left = 300: Command1.Top = 2670
Command1.Width = 910: Command1.Height = 330
Command1.Caption = "Draw Line": Command1.Enabled = False
End Sub

Drawing Lines With A Difference!
hi im makin an icon editor, so basically a square of colour (representing a pixel) is created on the screen everytime the "pen" mode is used

Picture1.DrawMode = vbCopyPen
Picture1.Line (X * Zoom, Y * Zoom)-(X * Zoom + Zoom - 2, Y * Zoom + Zoom - 2), Col, BF

thsi works fine however im trying to make a line version, at the moment ive created a line function which draws the thin line style vb allows

(it uses XoR pen to show a preview of the line before you draw it)

i would like a way though, of being able to quickly loop through all co-ordinates of the line (preview as well as final) and drawing the square of colour on there, so basically i loop from the first point in the line, calling the DrawDot function (partiall displayed above) on the co-ordinates the line lies on.

i know this may be hard to understand but ANY help is much appreciated
thanks

Drawing Lines At Run Time ..
well this is what i have done till now now here i have got stuck a bit ... now i want my user to be able to draw connection lines at run time ... like u can take a look at the image i have attached .. having different scenarios of connection lines between my pictures ... these scenarios are arbitrary .. jus to show you guys .. how these pictures have to be connected ..... for a lil more explanation you can assume these pictures ( xio and picbox) as open and close connection to electric circuit ( ote is for output ) ... ... pictures connected to each other horizontally are assumed to be "and-ed" with each other and pictures connected vertically to each other are assumed to be "or-ed" ...power flow is from extreme left to extreme right .. one power flow line can have many "ORed " and "ANDed" pictures connected to it ... but output should be only one and thts too at extreme right (i have not taken output in scenarios .. but its there ) .... as u can see in scenarios3 image file i have attached ... user can connect these pictures according to his will .. how can i make this possible ..... i hope i have make sense ..

i jus want to be able to interconnect my pictureboxes ... as i have shown in the attached picture

i think its still confusing ... ok jus tell me .. how would i be able to draw lines at run time .. ....... and later could scan those lines as well ... regards ..

Drawing Lines To Cells With VBA
Hi,

I have a couple of rows (which change in numbers of rows when I use another macro) and I want to put a double line at the bottom of the last row. I used the recorder to find the beginning of my code and then I modified it for my specific needs. But it says that the method Range of the object '_Global' failed. I need my line to be drawn from colomn A to AE. Does anyone see where is the problem in my code?
Thx!

Werner


Quote:





Sub Draw_Double_Line()

'Line that find the number of rows.
Let lstRw = Sheets("Formulaire").Range("a65536").End(xlUp).Row

With Worksheets("Formulaire")
Range("A:AE" & lstRw).Borders(xlDiagonalDown).LineStyle = xlNone
Range("A:AE" & lstRw).Borders(xlDiagonalUp).LineStyle = xlNone
Range("A:AE" & lstRw).Borders(xlEdgeLeft).LineStyle = xlNone
Range("A:AE" & lstRw).Borders(xlEdgeTop).LineStyle = xlNone
With Range("A:AE" & lstRw).Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = 1
End With
Range("A:AE" & lstRw).Borders(xlEdgeRight).LineStyle = xlNone

End With

End Sub

Drawing Lines To Chart Using VB
Hi,

I have a chart drawn in Excel using VB language. I need to include 2 lines to indicate the 3dB cutoff position in the excel. How can I draw the 2 lines ? For example X=2 and X = 2.9 for the 2 lines to be drawn onto the same chart.

Any help or other alternatives are appreciated. thanks in advance

Drawing Lines On Top Of A Grid
Hello all,

I just have a quick question that hopefully someone will be able to answer. I've been working on it for quite some time and haven't really figured it out. Here's my problem: I'm programming a Cross Stitch program that will allow a user to create patterns. I've used a grid for this so when they click on a cell it will make it the color of their choosing. (Think MS Paint but with gridlines) My problem is when there is a backstitch, I want it to be able to put a line over top of the grid. (Eventually I'll get it snaping to the grid) Here's an example on what I'd like to accomplish:
http://jenutech.com/grid.jpg


I'm not too concerned with what type of grid I need to used (MS Flexgrid, DB grid etc) but I'd really like to know how to get the line to go over top of the grid. I've tried various different grids and had the line Send to Front and the grid Send to Back but nothing seems to work. I programmatically added lines but that does the same thing. I've even simulated a grid by using textboxes but that takes too long to load up. (The grids will typically be around 300X300 which is a heck of a lot of text boxes!) Any help would be greatly appreciated!

Thanks!

Drawing Lines In Picturebox
I have a picture box that is 500 pixels wide. I need to have a white line drawn every 25 pixels across the top ttat would extend down 2 pixels in length. I have never worked with the drawing commands so could someone point me in the right direction to get this done????

Thanks Rick

Drawing Lines In Pictures
Hey!
Could someone please explain how the picturebox.line works. I know it's not difficult, but I can't seem to figure it out. Thanks a lot!!

Drawing Lines On The Screen
I believe this is an API question. Is there any way to draw a simple line (no fancy appearance settings necessary)... but... the line needs to be outside of forms etc. -- On the user's desktop.

It does not seem that such a thing would be possible.

Any suggestions or similar functionality would be great!


Thanks!!

Drawing Dashed Lines
Hello,

I'm trying to draw dashed lines using code like this


Code:
CreatePen( PS_GEOMETRIC | PS_DASH, 0, RGB(255,255,255))
However, I always get a solid pen. What's wrong?

Thanks in advance

Could I Get Some VB Help With Drawing Lines From Coordinates?
I need to write code for a form called frmDraw that when the user presses the mouse button at one point, moves the mouse and then releases the button at a second point, a line is drawn on the form between the two points. I know I have to store the X, Y coordinates during the MouseDown and MouseUp events in form-level variables, and in MouseUp call Refresh, which will trigger a call to the form’s Paint method.

Drawing Lines That One Can Delete?
Hello, I know how to dynamically create and drag around an image or label.

However I am curious if it is possible to dynamically create a line that a user can make their own length by dragging.

The big thing I am wanting to see is how can a user then click on that line to delete it?

Any ideas?

Drawing Lines To The Screen.
Hi,
I'm wondering what the best way of drawing lines, and possibly text to the screen is. Not to the form, just anywhere on the screen, on top of all windows etc.

Cheers!

Drawing Lines - Interesting Way. Help Me
Hi all
I am not strong with graphic therefore I ask about help

How to make to draw in select of direction line?

Idea

1. left clicking on form - drawing on form point
2. write to txt1 length of line ( the unit - can be cm, that fit to grid 1cm x 1cm )
3, I have 4 buttons put in shapes of cross , on them 4 directions of world now; North, South East and West
4. clicking after execute of writes on definite button will cause drawing line about length declare oneself in txt1, in indicate on clicked buttons direction.

I have hopes that I expressed brightly. Does someone have some idea and it can me prompt something?

thanx

Drawing 2 Lines On Usercontrol
Hi,

I'm having a weird problem with drawing a red cross on a usercontrol in its Paint() event:


Code:
UserControl.Line (0, 0)-(UserControl.Width, UserControl.Height), RGB(255, 0, 0)
UserControl.Line (0, UserControl.Height)-(UserControl.Width, 0), RGB(255, 0, 0)


Am I using the wrong coördinates? As long as I know the x-axis goes from left to right and the y-axis from up to down.
The thing I see is only one red line from topleft to bottomright...

Thx in advance,

RaKKeR

Drawing Lines In A Text Box
I have an application that contains several large text boxes for users to type information in to. In additon to text I would like to provide them the ability to draw pictures in the box.


I would like to use the line drawing method as I would in a picture box but apparently you can't do it with a text box.... or can you

ideas?

Drawing Lines On A Form
I was trying to get it to draw a line thicker then what vb has set up, so far to get a line I got this:
VB Code:
Option ExplicitDim prevX As LongDim prevY As LongDim bClicked As Boolean  Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)  If bClicked = False Then        prevX = X        prevY = Y        bClicked = True    Else        Me.Line (X, Y)-(prevX, prevY)        prevX = X        prevY = Y        bClicked = False    End If    End Sub



How do I get it to draw different line, or a line customized to my choosing?

Question About Drawing Lines-&gt;
This code generates a two pairs of coordinates
and should calculate the coordinates necessary
to draw a line from one pair of coordinates to the other.
The code works fine as long distance between x1 and x2
is the same as the distance between y1 and y2 .
The problem is that the code will not work properly when
the two distances are different from each other.


Code:
Randomize Timer
X1 = Int(Rnd * (ScaleWidth))
Y1 = Int(Rnd * (ScaleHeight))
X2 = Int(Rnd * (ScaleWidth))
Y2 = Int(Rnd * (ScaleHeight))

XDistance = X2 - X1
YDistance = Y2 - Y1
StepX = Sgn(XDistance)
StepY = Sgn(YDistance)

Do Until X1 = X2 And Y2 = Y2
PSet (X1, Y1), 0
If Not X1 = X2 Then X1 = X1 + StepX
If Not Y1 = Y2 Then Y1 = Y1 + StepY
Loop


So the question is what change needs to be made to
this code to make it work?

By the way:
I know the LINE method could be used to draw lines.
It simply doesn't do what I need.

Drawing Lines [drawn]
If I have the top and left attributes of two things. How can I draw a line connecting the two points together?

Directx7 Drawing Lines
I know this should be posted on the games & graphics forum, but this one is usually a lot quicker.


Anyway, i'm trying to draw lines on a dx7 surface.

I can draw the lines but cannot get them to be drawn in any colour other than white.

I've tryed the command below to no avail.

BackBuffer.SetFillColor RGB(255, 0, 0)


Thanks for any help.

Drawing Circles And Lines
Hi,
I've got a problem concerning the drawing of lines and circles.
I have a circle that should be move simultanously with a line that starts in the centre of the circle. The drawing itself is no problem, but if I'm moving them together, the relative position of the line and circle to each other is not stable, the line seems to move around a bit.
I'm using a User-Scale Mode, which I do need (that's my chart-projection).
Thank's

Drawing Lines And Rectangles
What's the best way to draw lines and rectangles (3d would be good)?  At the moment I am using a line control in a control array.

Cheers,

Ladyhawk.                   
** ASP/VB/Java Programmer **

Drawing Lines Dynamically
Im trying to create a form which is going to be a map of a lab i need to know is it possible to link certain fields in a microsoft access database to cordinates ie port number 5  to graph point 6 6 and if so does anyone know how to do it

Drawing Lines Over Mschart
Hi all,

 I am using MSChart control to draw the charts for some real time data. I can successfully implement the same. The issue here is to draw to lines over the MSChart control which should move according to the coordinates given from the database.
Can anyone please get me the solution for the above issue? it is very urgent.

Thanks in advance,
dpr

Please Help With Drawing Straight Lines
I’m not sure how to explain my problem, except to say that some of
my straight lines that I am trying to draw aren’t so straight
so I set up a this project to use as an example. If anyone would
be kind enough, set up and run this project and follow the
caption of Label3 at the top of the picturebox to see my
explaination. If I set the Picture1.ScaleMode property to Pixel,
it seems to work fine. But I need the ScaleMode property set to
Twips so that I can later use two picture boxes and scrollbars
for a scrollable picture box.

Place these controls “any where any size” on Form1
The Form1 Load Event will set the position’s and properties of all the
Controls.

One Picturebox. Named Picture1
Three Textboxes. Named Text1, Text2 and Text3.
Four Labels. Named Label1, Label2, Label3 and Label4.
One Command Button. Named Command1
One more Label “placed inside of Picture1”. Named Label5.

Paste this code in the declarations of Form1.


Option Explicit
Dim CurX, CurY, Mag, lnX1, lnY1, lnX2, lnY2, lnLength As Single
Dim Pi, Angle As Single
Dim Info As String
Dim InfoCounter As Integer


Private Sub Form_Load()
        Pi = 3.14159265358979
    Call Set_Position_And_Size_All_The_Controls_On_The_Form
End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        CurX = X: CurY = Y
        Command1.Enabled = True
    Call Set_Node
    Call Explanation 'Show my dumb comments in Label3.Caption
End Sub

Sub Set_Line_Properties()
    Dim SideA, SideB As Single
    
    lnX1 = CurX: lnY1 = CurY: Mag = Text3.Text
    lnLength = Mag * Text1.Text: Angle = Text2.Text
        
        'I think this is where my problem is
        SideA = Sin(Angle * Pi / 180) * lnLength
        SideB = Cos(Angle * Pi / 180) * lnLength
        
    Select Case Angle
        Case 0
            lnX2 = CurX
            lnY2 = CurY - lnLength
        Case 45
            lnX2 = CurX + SideA
            lnY2 = CurY - SideB
        Case 90
            lnX2 = CurX + lnLength
            lnY2 = CurY
        Case 135
            lnX2 = CurX - (-SideA)
            lnY2 = CurY + (-SideB)
        Case 180
            lnX2 = CurX
            lnY2 = CurY + lnLength
        Case 225
            lnX2 = CurX + SideA
            lnY2 = CurY - SideB
        Case 270
            lnX2 = CurX
            lnY2 = CurY - lnLength
        Case 315
            lnX2 = CurX + SideA
            lnY2 = CurY - SideB
        Case 360
            lnX2 = CurX - lnLength
            lnY2 = CurY
        Case Else
        'How can I do other Angles here?
        Exit Sub
    End Select
    
    CurX = lnX2: CurY = lnY2
    Call Set_Node
End Sub

Private Sub Command1_Click()
    Call Set_Line_Properties
    Picture1.Line (lnX1, lnY1)-(lnX2, lnY2), vbBlue
    Call Explanation 'Show my dumb comments in Label3.Caption
End Sub

Sub Set_Node()
'Sets a red node at CurX,CurY position
    Label5.Width = 50: Label5.Height = 50
    Label5.BackColor = &HFF&: Label5.Visible = False
    Label5.Top = CurY - 15: Label5.Left = CurX - 15
    Label5.Visible = True
End Sub


Sub Explanation()
        'All my dumb comments shown in the Label3 Caption
InfoCounter = InfoCounter + 1
    Select Case InfoCounter
        Case 1
            Info = "Click on the Picturebox to set the" _
            & " CurX and the CurY for the starting" _
            & " point of the line to be drawn"
        Case 2
            Info = "Notice the Angle value. The Line will be drawn" _
            & " straight up. Press Draw Line Button"
        Case 3
            Info = "Notice the Angle value has changed to 45" _
            & " Press Draw Line"
            Text2.Text = 45
        Case 4
            Info = "Notice the Angle value has changed to 135" _
            & " Press Draw Line again."
            Text2.Text = 135
        Case 5
            Info = "Here is my problem. Why is this line not" _
            & " straight? Press Draw Line again."
            Text2.Text = 225
        Case 6
            Info = "This line is not straight either." _
            & " Press Draw Line yet again."
            Text2.Text = 315
        Case 7
            Info = "But this Line is straight. One more time and" _
            & " I will shut up "
        Case 8
            Info = "I would appreciate any help I could get!!!"
            Text2.Text = 45
            Text1.Enabled = True: Text2.Enabled = True: Text3.Enabled = True
        End Select
        
   Label3.Caption = Info

End Sub
Sub Set_Position_And_Size_All_The_Controls_On_The_Form()
'Set's all the control properties
Form1.WindowState = 2

Picture1.Width = 5950: Picture1.Height = 4950
Picture1.Top = 800: Picture1.Left = 2150
Picture1.BackColor = &H80000009: Picture1.MousePointer = 2
Picture1.AutoRedraw = True: Picture1.ScaleMode = 1 'Need to stay Twips

Text1.Left = 1275: Text1.Top = 1335
Text1.Width = 675: Text1.Height = 285
Text2.Left = 1275: Text2.Top = 1680
Text2.Width = 675: Text2.Height = 285
Text3.Left = 1275: Text3.Top = 2020
Text3.Width = 675: Text3.Height = 285
Text1.Text = 24: Text2.Text = 0: Text3.Text = 20
Text1.Enabled = False: Text2.Enabled = False: Text3.Enabled = False

Label1.Width = 900: Label1.Height = 270
Label1.Top = 1385: Label1.Left = 265
Label2.Width = 900: Label2.Height = 270
Label2.Top = 1720: Label2.Left = 265
Label3.AutoSize = True: Label3.ForeColor = &HFF0000
Label3.FontSize = 10
Label3.Left = 265: Label3.Top = 325
Call Explanation
Label1.Caption = "Line Length": Label2.Caption = "Angle"
Label4.Width = 900: Label4.Height = 270
Label4.Top = 2115: Label4.Left = 265
Label4.Caption = "Mag"
Label5.Visible = False

Command1.Left = 300: Command1.Top = 2670
Command1.Width = 910: Command1.Height = 330
Command1.Caption = "Draw Line": Command1.Enabled = False
End Sub

Drawing Lines With VB In A Word Doc
I'm working to program a Word application with VB.I need to set lines and pictures and textboxes an a exactly defined place to at least print a formular. I have the length of the lines and also the X,y position of each line. Some are horizontal and some vertical. I have tried doing with recording a macro, but I couldn't find out how i get it placed on an exact place. The same for a textbox to set it on an exact position.

Thanks for any help

Jonny Poet

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