Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

Draw a line in a form - how ?

I wrote: "form1.Line(0,0)-(200,200), RGB(0,0,255)", and even put a "form1.refresh", but when "form1.show" is executed, there is no line drawn !?!! Can someone shower some help ? Thanks !!
0
collinng
Asked:
collinng
1 Solution
 
electrickCommented:
You must invoke Show() before you draw the line. In other words,
you have to have a form displayed before you can draw on it.

0
 
swiltCommented:
A form is only displayed when .show is executed or End Sub of the form load is reached

the following code will work

Private Sub Form_Load()
    Form1.Show
    Form1.Line (0, 0)-(200, 200), RGB(0, 0, 255)
End Sub


OR


Private Sub Form_Paint()
    Form1.Line (0, 0)-(200, 200), RGB(0, 0, 255)
End Sub

0
 
collinngAuthor Commented:
Electrick and Swilt are both correct. In addition, I can also draw a line after show() - as long as the instructions are not in Form_Load() module. However, I still don't understand why Line instruction in Form_Load() module doesn't work - but nebermine, that's just too detailed to bother about. Thanks so much, I appreciate it !
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now