先看效果
無邊框設定windowstyle=「none」,視窗無關閉及縮放按鈕,但還有黑邊;設定allowstransparency=「true」,黑邊沒有了。
全屏,遮住工作列
拖動this.windowstate = system.windows.windowstate.normal;
this.windowstyle = system.windows.windowstyle.none;
this.resizemode = system.windows.resizemode.noresize;
= true;
//設定全屏
this.left = 0.0;
this.top = 0.0;
this.width = system.windows.systemparameters.primaryscreenwidth;
this.height = system.windows.systemparameters.primaryscreenheight;
另一種拖動方式//xaml
mousemove="move_mousemove"
//cs
private void move_mousemove(object sender, mouseeventargs e)
}
不能拖動太快
或者,這種需要慢點拖,否則會有問題system.drawing.point mousecursor_point;
system.drawing.point mousecursor_point_aux;
double mtop = 0;
double mleft = 0;
private void button_mousemove(object sender, mouseeventargs e)
,)");
}else
}else
}
system.drawing.point mousecursor_point;
system.drawing.point mousecursor_point_aux;
private void button_mousemove(object sender, mouseeventargs e)
mousecursor_point = system.windows.forms.cursor.position;
}
WPF無邊框視窗滑鼠拖動縮放大小
通常,我們會 通過allowstransparency true windowstyle none 這兩個屬性將wpf視窗的邊框去掉,由於邊框沒了,我們就不能通過滑鼠指標懸停在某一邊上拖動改變視窗的大小,此時若要能調整視窗大小,官方倒也提供了個屬性 resizemode canresizewithg...
c 無邊框拖動
static class safenativemethods protected override void onmousedown mousebuttoneventargs e 拖動protected override void wndproc ref message m return case ...
拖動無邊框窗體
frm main.cs 1 using system 2using system.collections.generic 3using system.componentmodel 4using system.data 5using system.drawing 6using system.linq ...