How to avoid dragging a form
-
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; } } I have set the method FrmExplorer_CancelDrag in FrmExplorer Properties in the event QueryContinueDrag. But I still cannot reach the method FrmExplorer_CancelDrag when dragging the form to cancel that action. Does anybody can help me to know what I'm doing wrong or what is it missing? Thanks a lot in advance, Elvia