我这里有点问题。我正在尝试在整个屏幕上绘制一些东西,我有一个没有可见边框的全屏表单,但是,我无法在边框位置上绘制,因此将有大约 20+ 像素的空间,上面什么都没有绘制边缘。我想我可以扩大窗口大小,使其从底部和右侧越过屏幕,但您不能将位置设置为小于 0,0,因此顶部和左侧边框仍然会挡住我的绘图。
简而言之:如何在边框上绘制?
One approach is to get rid of the border entirely. You can draw your own simulated border as needed.
To do that, set the ControlBox property to false. Set the form's Text property to string.Empty. Set the border to FixedDialog to make the form unresizable.
In order to still be able to move the form you must override WndProc like this:
protected override void WndProc(ref Message message)
{
switch (message.Msg)
{
case 0x84:
message.Result = new IntPtr(0x2);
return;
}
base.WndProc(ref message);
}
That code tricks Windows into thinking that mouse clicks on the non-client area are actually on the title bar.
See http://msdn.microsoft.com/en-us/library/ms645618%28VS.85%29.aspx