我希望用户调整右下角无边框窗口的大小,就像我可以调整组合框控件的自动完成窗口的大小一样。
我找不到以这种方式配置表单的属性。
也许有人可以帮助我解决这个问题。
可以在这里找到图像:
这是与 Franci 的解释相对应的代码,我正在编写它,但他同时回答了,所以投票支持他的解释,如果该代码适合您的需求,这很好。
protected override void WndProc(ref Message m) {
const int wmNcHitTest = 0x84;
const int htBottomLeft = 16;
const int htBottomRight = 17;
if (m.Msg == wmNcHitTest) {
int x = (int) (m.LParam.ToInt64() & 0xFFFF);
int y = (int) ((m.LParam.ToInt64() & 0xFFFF0000) >> 16);
Point pt = PointToClient(new Point(x, y));
Size clientSize = ClientSize;
if (pt.X >= clientSize.Width - 16 && pt.Y >= clientSize.Height - 16 && clientSize.Height >= 16) {
m.Result = (IntPtr) (IsMirrored ? htBottomLeft : htBottomRight);
return;
}
}
base.WndProc(ref m);
}
编辑:要编写夹具,您可以初始化一个new VisualStyleRenderer(VisualStyleElement.Status.Gripper.Normal)
并使用其PaintBackground()
method.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)