移动窗体无边框样式 [英] Move form without border style

查看:175
本文介绍了移动窗体无边框样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何移动无边界的形式?我试过在互联网上看,但没有。非常感谢。

how do I move a borderless form? I tried looking on the internet, but nothing. Thanks a lot.

推荐答案

您可以使用任何包含的控件(包括其自身)拖动表单。

You can drag a form using any contained control, including itself.

使用以下示例,您可以通过单击其画布并拖动来移动表单。您可以通过在面板的MouseDown事件中放置相同的代码来实现与表单上的面板相同的操作,这将允许您创建自己的伪标题栏。

Using the following example, you can move a form by clicking on its canvas and dragging. You could do the same with a panel on the form by putting the same code in the panel's MouseDown event, which would let you create your own pseudo caption bar.

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
const
  SC_DRAGMOVE = $F012;
begin
  if Button = mbLeft then
  begin
    ReleaseCapture;
    Perform(WM_SYSCOMMAND, SC_DRAGMOVE, 0);
  end;
end;

这篇关于移动窗体无边框样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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