15 Replies  2356 Views  Last Post: 07 June 2012  12:36 PM
#1
how to add a vector in vb6 ?
Posted 26 May 2012  04:18 AM
I make a program you give the angle and long and he draw it
but i do it with line tool, and i want to put an arrow on the head of line, or can u give me a new tool
thank you,
حسن
Replies To: how to add a vector in vb6 ?
#2
Re: how to add a vector in vb6 ?
Posted 29 May 2012  10:00 AM
This post has been edited by BobRodes: 29 May 2012  10:02 AM
#3
Re: how to add a vector in vb6 ?
Posted 01 June 2012  12:43 PM
but.....i open this link http://www.vbhelper...raw_arrows.html and i find a code and i use it in different project it draw some arrow but i don't understand the code so i can't enter it in my program i just want a arrow in the top of line have a constant angle between the line and one side of arrow and constant long, and whatever i change the X2 and Y2 the angle between the two side still 45 degree (or an other constant angle)
hope someone can make this code more easier or more useful , anyway thanks for anyone try to help me
Hassan,
#4
Re: how to add a vector in vb6 ?
Posted 02 June 2012  12:54 AM
you can find the solution through one of the links
http://www.dreaminco...ogclockinvb/
http://stackoverflow...tionwithangle
http://stackoverflow...cangleinjava
#5
Re: how to add a vector in vb6 ?
Posted 04 June 2012  07:27 AM
#6
Re: how to add a vector in vb6 ?
Posted 04 June 2012  09:05 AM
N1 = Text1.Text NO1 = Text2.Text An1 = Text3.Text Form1.L1.X1 = 5000 ' the center of graph Form1.L1.Y1 = 5000 ' the center of graph a = Tan(Val(An1) * ttdeg) L1.X2 = (Val(NO1) * Cos(Val(An1) * ttdeg)) * 588.235294117647 + 5000 ' L1 is a line L1.Y2 = (a * Val(NO1) * Cos(Val(An1) * ttdeg)) * 588.235294117647 + 5000 'okay here N1 is name of vector and NO1 is the long of vector and An1 is the angle of vector 'and when user enter the long and the angle of line and click command button directly the line will draw
and what i want to just add a two new line that will be the two side of arrow
#7
Re: how to add a vector in vb6 ?
Posted 04 June 2012  09:17 AM
Private Sub Command1_Click() ' add text1,text2,text3,command1 and line rename it to "L1" Const ttdeg = 1.74532925199433E02 ' = pi/180 = 3.14/180=ttdeg N1 = Text1.Text ' as string NO1 = Text2.Text ' as double An1 = Text3.Text ' as double L1.X1 = 5000 ' the center of graph L1.Y1 = 5000 ' the center of graph a = Tan(Val(An1) * ttdeg) 'ttdeg just for transform from radian to degree L1.X2 = (Val(NO1) * Cos(Val(An1) * ttdeg)) * 588.235294117647 + 5000 ' L1 is a line L1.Y2 = (a * Val(NO1) * Cos(Val(An1) * ttdeg)) * 588.235294117647 + 5000 'okay here N1 is name of vector and NO1 is the long of vector and An1 is the angle of vector 'and when user enter the long and the angle of line and click command button directly the line will draw end sub
i just find some wrong in the code so this is the right one
#8
Re: how to add a vector in vb6 ?
Posted 04 June 2012  01:57 PM
#9
Re: how to add a vector in vb6 ?
Posted 05 June 2012  01:24 PM
#10
Re: how to add a vector in vb6 ?
Posted 06 June 2012  06:24 AM
#11
Re: how to add a vector in vb6 ?
Posted 06 June 2012  01:34 PM
second it's mathematical difficult so maybe i need more lesson to learn how i will do it
3rd thank you for help when i finch my program i will send you a download link
thanks,
#12
Re: how to add a vector in vb6 ?
Posted 06 June 2012  03:35 PM
This post has been edited by BobRodes: 06 June 2012  03:35 PM
#13
Re: how to add a vector in vb6 ?
Posted 07 June 2012  05:28 AM
http://www.mediafire...rh9bkf136t7h8f8
this is a light project i do it for who need help
and my program need some time to released it's just need time
thanks
and special thanks for BobRodes
#14
Re: how to add a vector in vb6 ?
Posted 07 June 2012  06:05 AM
Now, perhaps you will post your code here so other people can see how it's done. (It's better to post your code here than to provide a link; people aren't always willing to do a download.)
This post has been edited by BobRodes: 07 June 2012  06:08 AM
#15
Re: how to add a vector in vb6 ?
Posted 07 June 2012  11:38 AM
and i will put the code here
Private Sub Command1_Click() 'what to add: 'Text1 for angle 'text2 for long (norme en francais) 'three line the first name it "L1" ,the seconde "A1" and 3rd "A2" 'enjoy Dim a As Double Dim b As Double Dim c As Double Dim NO1 As Double Dim An1 As Double Const ttdeg = 1.74532925199433E02 ' = pi/180 = 3.14/180 ' the normal line An1 = Val(Text1.Text) NO1 = Val(Text2.Text) L1.X1 = 5000 L1.Y1 = 5000 a = Tan(Val(An1) * ttdeg) L1.X2 = (Val(NO1) * Cos(Val(An1) * ttdeg)) * 580 + 5000 L1.Y2 = (a * Val(NO1) * Cos(Val(An1) * ttdeg)) * 580 + 5000 '///////////////////////////////////////////////////////////////////////////// ' the two side of arrow A1.X1 = Val(L1.X2) A1.Y1 = Val(L1.Y2) b = Tan(Val(An1 + 180 + 30) * ttdeg) A1.X2 = 200 * Cos((An1 + 180 + 30) * ttdeg) + L1.X2 A1.Y2 = b * 200 * Cos(Val(An1 + 180 + 30) * ttdeg) + L1.Y2 A2.X1 = L1.X2 A2.Y1 = L1.Y2 b = Tan(Val(An1 + 180  30) * ttdeg) A2.X2 = 200 * Cos((An1 + 180  30) * ttdeg) + L1.X2 A2.Y2 = b * 200 * Cos(Val(An1 + 180  30) * ttdeg) + L1.Y2 ' last information : free Palestine (;;)/> End Sub
