how to add a vector in vb6 ?

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 2401 Views - Last Post: 07 June 2012 - 12:36 PM Rate Topic: -----

#1 Hassan kanso  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 15
  • Joined: 26-May 12

how to add a vector in vb6 ?

Posted 26 May 2012 - 04:18 AM

Hello,
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,
حسن
Is This A Good Question/Topic? 0
  • +

Replies To: how to add a vector in vb6 ?

#2 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: how to add a vector in vb6 ?

Posted 29 May 2012 - 10:00 AM

I have a new tool for you. Here's a little tutorial on how to use it, complete with a pretty obvious sample input. Just click on the top link in the list that comes up, and it will show you some code to use.

This post has been edited by BobRodes: 29 May 2012 - 10:02 AM

Was This Post Helpful? 1
  • +
  • -

#3 Hassan kanso  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 15
  • Joined: 26-May 12

Re: how to add a vector in vb6 ?

Posted 01 June 2012 - 12:43 PM

thanks you BobRodes,
but.....i open this link http://www.vb-helper...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,
Was This Post Helpful? 0
  • +
  • -

#4 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: how to add a vector in vb6 ?

Posted 02 June 2012 - 12:54 AM

use this tutorial it will surely show some idea how to create a custom control and also some ideas about drawing the lines in specific manner in vb6.0
you can find the solution through one of the links
http://www.dreaminco...og-clock-in-vb/

http://stackoverflow...tion-with-angle

http://stackoverflow...c-angle-in-java
Was This Post Helpful? 0
  • +
  • -

#5 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: how to add a vector in vb6 ?

Posted 04 June 2012 - 07:27 AM

All right, so you've actually written some code. Suppose you show us what you have tried so far.
Was This Post Helpful? 0
  • +
  • -

#6 Hassan kanso  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 15
  • Joined: 26-May 12

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
Was This Post Helpful? 0
  • +
  • -

#7 Hassan kanso  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 15
  • Joined: 26-May 12

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.74532925199433E-02    ' = 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
Was This Post Helpful? 0
  • +
  • -

#8 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: how to add a vector in vb6 ?

Posted 04 June 2012 - 01:57 PM

Let's say your arrow needs to be two lines at an angle of 60 degrees. We'll call them A1 and A2. You just need the angle of your line (cal it la) and the endpoint (call it e) that you want the arrow on. A1's angle is la - 30; a2's is la + 30. Both lines have one endpoint = e, and you calculate the other endpoint based on the length of the arrow and the a1 or a2 angle.
Was This Post Helpful? 0
  • +
  • -

#9 Hassan kanso  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 15
  • Joined: 26-May 12

Re: how to add a vector in vb6 ?

Posted 05 June 2012 - 01:24 PM

i understand a little bit about your way to draw it , but i can't understand what is the code to do it so please can you give me a simple code , i can't create my program without this arrow ,thanks..
Was This Post Helpful? 0
  • +
  • -

#10 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: how to add a vector in vb6 ?

Posted 06 June 2012 - 06:24 AM

Nope, I sure can't. Asking others to do your work for you is just lazy, and I wouldn't be doing you any favors to help you develop lazy thinking habits. Make an attempt yourself, and ask for help if you get stuck. You might be surprised at how far you get.
Was This Post Helpful? 0
  • +
  • -

#11 Hassan kanso  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 15
  • Joined: 26-May 12

Re: how to add a vector in vb6 ?

Posted 06 June 2012 - 01:34 PM

haha my friend.......first it's not my work it's my hobby,and i learn programming from internet and PDF books, so i don't feel lazy because it's my passion and i love to make programs
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,
Was This Post Helpful? 0
  • +
  • -

#12 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: how to add a vector in vb6 ?

Posted 06 June 2012 - 03:35 PM

Well, don't be a lazy thinker with your hobbies either. I'm a pretty good classical pianist, and I don't ask anyone to do my practicing for me. :P

This post has been edited by BobRodes: 06 June 2012 - 03:35 PM

Was This Post Helpful? 0
  • +
  • -

#13 Hassan kanso  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 15
  • Joined: 26-May 12

Re: how to add a vector in vb6 ?

Posted 07 June 2012 - 05:28 AM

yeeeeeey i do it and now it draw an arrow for my pretty line :)
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 :)
Was This Post Helpful? 0
  • +
  • -

#14 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: how to add a vector in vb6 ?

Posted 07 June 2012 - 06:05 AM

Now aren't you glad I didn't write it for you? In the end, looks like the only "new tool" you needed is your mind. :) Good job following through and working out the problem.

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

Was This Post Helpful? 0
  • +
  • -

#15 Hassan kanso  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 15
  • Joined: 26-May 12

Re: how to add a vector in vb6 ?

Posted 07 June 2012 - 11:38 AM

i thank you because you cared for my problem :D
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.74532925199433E-02   ' = 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


Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2