On the request of another user of these forums, would it be faster to use DirectX to draw 500,000 lines to the screen than a picturebox?

I helped him by showing him how to populate a UDT array from that huge file under 250ms which contains:

start x,y
end x,y
line color
line thickness

The problem is it takes 11 seconds to draw 500,000 lines to the picturebox on an athalon 1.5ghz machine....

I imagine it would be easier to write directly to video ram using directX.. Neither of us know how to program DirectX.. especially since a requirement is that the screen can be zoomed, and with a picturebox, that would mean refeeding all those values and redrawing those lines...

Here's the code so far:
VB Code:
  1. Option Explicit
  2. 'User Defined Type below holds startxy, endxy, linecolor,linethickness
  3. Private Type mapLineType
  4.     XPosStart As Single
  5.     YPosStart As Single
  6.     XPosEnd As Single
  7.     YPosEnd As Single
  8.     Colour As Long
  9.     Thickness As Single
  10. End Type
  11.  
  12. 'dim a UDT of size 500,000
  13. Private mapLine(500000) As mapLineType
  14.  
  15. Private Sub Command1_Click()
  16. Dim i As Long
  17. Picture1.Scale (0, 0)-(7000, 7000)
  18.  
  19. 'create some random test numbers
  20. For i = 1 To 500000
  21. mapLine(i).XPosStart = Int(7000 * Rnd + 1)
  22. mapLine(i).YPosStart = Int(7000 * Rnd + 1)
  23. mapLine(i).XPosEnd = Int(7000 * Rnd + 1)
  24. mapLine(i).YPosEnd = Int(7000 * Rnd + 1)
  25. mapLine(i).Colour = Int(31000 * Rnd + 1)
  26. mapLine(i).Thickness = Int(2 * Rnd + 1)
  27. Next
  28.  
  29. 'save test numbers to file
  30. Open ("C:\testfile.tst") For Binary As #1
  31. Put #1, 1, mapLine
  32. Close #1
  33. MsgBox ("array populated and saved")
  34.  
  35. 'load in test numbers
  36. Open ("C:\testfile.tst") For Binary As #1
  37. Get #1, 1, mapLine
  38. Close #1
  39. MsgBox ("loaded")
  40.  
  41. 'draw test numbers
  42. For i = 1 To 500000
  43. Picture1.DrawWidth = mapLine(i).Thickness
  44. Picture1.Line (mapLine(i).XPosStart, mapLine(i).YPosStart)-(mapLine(i).XPosEnd, mapLine(i).YPosEnd), mapLine(i).Colour
  45. DoEvents
  46. Next
  47. MsgBox ("done")
  48. End Sub

Here's the link to the original post...
http://www.vbforums.com/showthread.p...hreadid=198679

I would imagine anyone who uses DirectX regularly would have no problem changing this code... any help would be appreciated and given credit for...