1 Using System;
2 Using System. Windows. forms;
3
4 Public Class Test: Form
5 {
6 Test ()
7 {
8 Text = " Do not drag the title bar. Double-click the title bar to make it unresponsive. " ;
9 Formborderstyle = Formborderstyle. fixeddialog;
10 Maximizebox = False ;
11 Minimizebox = False ;
12 }
13
14 Protected Override Void Wndproc ( Ref Message m)
15 {
16 Base . Wndproc ( Ref M );
17 If (M. msg = 0x84 && M. Result = (Intptr) 2 ) // Do not drag the title bar
18 {
19M. Result=(Intptr)1;
20}
21 If (M. msg = 0xa3 ) // No response is returned when you double-click the title bar.
22 {
23M. wparam=System. intptr. zero;
24}
25 }
26
27 Static Void Main ()
28 {
29Application. Run (NewTest ());
30}
31 }
From the perspective of the csdn forum, it is a pity that you can also right-click on the title bar to move the window. It should also be forbidden, but I am not familiar with wndproc and do not know how to implement it.