How to avoid dragging a form

Apr 5 2006 3:50 PM

Hi everybody!

 

I'm new on C# programming. I have a main form in my Windows applications that contains other form as a Explorer of folders. I don't want to allow to drag the Explorer form (FrmExplorer). FrmExplorer has a TreeView. I have been looking for information about it and have written the following code:

 

public partial class FrmExplorer : Form

{

 

        public FrmExplorer(string fileName)

        {

            InitializeComponent();

            this.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.FrmExplorer_CancelDrag);

        }

 

        private void FrmExplorer_CancelDrag(object sender, QueryContinueDragEventArgs e)

        {

            e.Action = DragAction.Cancel;

        }

}