如何在没有标题栏的情况下移动窗口 [英] How to move a window without title bar

查看:96
本文介绍了如何在没有标题栏的情况下移动窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使没有标题栏的窗口移动?

How I can make a window without title bar to move?

推荐答案

哦,那并不难.

Oh well that is not that hard.

只是给您一个总体思路,请利用表单的Drag事件.这样,您就可以捕获当前的鼠标位置,并以此来计算表单的新位置.我从来没有在Windows窗体中做到过.

Just to give you an overall idea, make use of the Drag events of the form. This way you are able to capture he current mouse position and calculate the form's new position with it. I never did it in windows forms though.

基本流量:

MouseDown-注册鼠标按下,添加处理程序mousemove

MouseDown - Registers that the mouse is down, addhandler  mousemove

MouseMove-通过鼠标位置计算表单的位置

MouseMove - Calculate Form's position by the mouse position

MouseUp-删除MouseMove处理程序

MouseUp - Remove MouseMove handler

按照我的逻辑,这是最简单的方法.但是,您可能需要调查表单拖动"(或通常是控件拖动")事件.

This is for my logic the easiest way. However you might want to look into the Form Drag (or in general the Control Drag) events.

希望有助于了解一般想法

Hope that helped to get a general idea


这篇关于如何在没有标题栏的情况下移动窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆