1) add a line object, make it an array (set Index property to 0 - like line1 should become line1(0))
You can make it invisible or put out of bounds of form.
2) make a global var LC (LineCounter), set it to 0
3)
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
LC = LC + 1
Load Line1(LC)
With Line1(LC)
.X1 = X
.Y1 = Y
.X2 = X + Rnd * 1000 - 500
.Y2 = Y + Rnd * 1000 - 500
.Visible = True
End With
End Sub
Well, it was quick example - you have to tailor it to your needs.
Can't quite get it... please clarify:
> but i have to create up to 50 lines and they must be objects, because i have to save their positions.
either of ways suggested allow to create any (well, almost) amount of lines.
If you have to save positions - fine, store coords somethere (then restore if needed)...
Try to use
DrawStyle = 3
This is form attribute.
This thing works for lines drawn as line(x1,y1)-(x2,y2)
Actually I have to set DrawWidth to 1 to see it work. From the help:
----
If DrawWidth is set to a value greater than 1, DrawStyle settings 1 through 4 produce a solid line (the DrawStyle property value isn't changed). If DrawWidth is set to 1, DrawStyle produces the effect described in the preceding table for each setting.
----
The BorderStyle thing will work if you create line objects with Load statement.
Then you can use Line1(lc).BorderStyle
so Basic will know what object you are talking on. It will not work with DrawWidth>1 as well (at least it didn't at my machine.)
So it seems that there no easy way to draw dotted lines several pixels width.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.