小智 127
您可以FormBorderStyle在设计器或代码中将Property设置为none:
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
Run Code Online (Sandbox Code Playgroud)
Nik*_* G. 70
如果Blue Border thats on top of the Window Form你的意思是标题栏,将Forms ControlBox属性设置为false和Text属性为空字符串("").
这是一个片段:
this.ControlBox = false;
this.Text = String.Empty;
Run Code Online (Sandbox Code Playgroud)
cod*_*fun 23
还要将这段代码添加到表单中,以使其可以拖动.
只需在构造函数之前添加它(调用InitializeComponent()的方法
private const int WM_NCHITTEST = 0x84;
private const int HTCLIENT = 0x1;
private const int HTCAPTION = 0x2;
///
/// Handling the window messages
///
protected override void WndProc(ref Message message)
{
base.WndProc(ref message);
if (message.Msg == WM_NCHITTEST && (int)message.Result == HTCLIENT)
message.Result = (IntPtr)HTCAPTION;
}
Run Code Online (Sandbox Code Playgroud)
该代码来自:https://jachman.wordpress.com/2006/06/08/enhanced-drag-and-move-winforms-without-having-a-titlebar/
现在要摆脱标题栏但仍然有一个边框组合来自其他响应的代码:
this.ControlBox = false;
this.Text = String.Empty;
用这一行:
this.FormBorderStyle = FormBorderStyle.FixedSingle;
将这3行代码放入表单的OnLoad事件中,您应该有一个漂亮的"浮动"表单,可以使用细边框拖动(如果您不需要边框,请使用FormBorderStyle.None).
Jor*_*Dob 10
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Run Code Online (Sandbox Code Playgroud)