Link to home
Start Free TrialLog in
Avatar of collinng
collinng

asked on

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 !!
ASKER CERTIFIED SOLUTION
Avatar of electrick
electrick

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of swilt
swilt

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

Avatar of collinng

ASKER

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 !