Locking a Form in Position

Question:
How do you lock down a form so that when the program is run, you can not move it. What I want to do is have one main form, with another smaller form within it. I want to lock the smaller form in place so it can not be moved around. The only way I have been able to do this is to disable the form. But I need the form enabled. How would I accomplish this?

Answer:
I would recommend using the Paint event to position the form to aparticular X, Y coordinate pair. The Paint event is called whenever theform is drawn or moved. Just set the Top and Left properties of the formto your preselected values and the form will appear to be locked in place.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: