Drawing a line with JavaScript

Results 1 to 3 of 3

Thread: Drawing a line with JavaScript

  1. #1
    Join Date
    Dec 1969

    Default Drawing a line with JavaScript

    Is there any way to draw a line from coord a:a to coord b:b utilizing javascript? I just want to make a simple line drawing that is dynamically drawn (by asp)

  2. #2
    Join Date
    Dec 1969

    Default this MAY be of help....

    http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=454&lngWId=-1<BR><BR>I know it&#039;s not javascript, but maybe it will help.<BR><BR>************************************* *<BR>Name: Draw a line using VB code<BR>Description:An example to draw a line us<BR>ing VB code.<BR>By: StonePage<BR><BR>This code is copyrighted and haslimited warranties.Please see http://www<BR> .Planet-Source-Code.com/xq/ASP/txtCodeId<BR> .454/lngWId.-1/qx/vb/scripts/ShowCode.ht<BR>mfor details.**************************************<BR> <BR>&#039;create a new project<BR>&#039;paste the following code into the (Gene<BR>ral)(Declarations)<BR>&#039;<BR>Dim DrawSwitch As Integer<BR>Dim r As Integer, g As Integer, b As Int<BR>eger<BR>Sub Form_MouseDown(Button As Integer, Sh<BR> ift As Integer, X As Single, Y As Single<BR>)<BR>DrawSwitch = DrawSwitch - 1<BR>Select Case Button<BR>Case vbLeftButton<BR>r = 255<BR>g = 0<BR>b = 0<BR><BR>Case vbMiddleButton<BR>r = 0<BR>g = 255<BR>b = 0<BR>Case vbRightButton<BR>r = 0<BR>g = 0<BR>b = 255<BR>End Select<BR>CurrentX = X<BR>CurrentY = Y<BR>End Sub<BR>Sub Form_MouseMove(Button As Integer, Sh<BR> ift As Integer, X As Single, Y As Single<BR>)<BR>If DrawSwitch Then<BR>Line -(X, Y), RGB(r, g, b)<BR>End If<BR>End Sub<BR>Sub Form_MouseUp(Button As Integer, Shif<BR>t As Integer, X As Single, Y As Single)<BR>DrawSwitch = 0<BR>End Sub<BR>

  3. #3
    Join Date
    Dec 1969

    Default No way

    And that code Brian showed will *NOT* work in the browser. That&#039;s for doing it in a Visual Basic window, not in a browser window. (You *might* be able to use it inside a browser, *if* you can create a DLL using VB that is loaded by the browser. Now, try to convince people outside an inTRAnet to load your DLL...which would be perfectly capable of erasing every file on their hard drive.)<BR><BR>Anyway, JavaScript (and VBScript) has *zero* drawing capabilities. If you want to draw *in the browser*, you&#039;ll need to learn Java and use a Java applet. And, of course, convince people to let your Java applets run on their machines. (Which is easier than getting them to download your DLL, but still...)<BR><BR>Of course, the other possibility is FLASH. And that might be the most realistic one, if you are a relative newbie.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts