Double Click
如果发生时如何滚动和滚动Delphi Form Form.Style:=bsSingle
?
我已经定义了以下代码:
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs;
type
TForm1 = class(TForm)
private
{ Private declarations }
OldClientHeight: Integer;
procedure WMNCLButtonDblClk(var msg: TWMNCLButtonDblClk); message WM_NCLBUTTONDBLCLK;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMNCLButtonDblClk(var msg: TWMNCLButtonDblClk);
var
Height : integer;
begin
if (Msg.HitTest = HTCAPTION) then
Caption := 'Double Click';
begin
if (ClientHeight = 0) then
begin
for Height := 0 to OldClientHeight do ClientHeight := Height;
Application.ProcessMessages;
end
else
begin
OldClientHeight := ClientHeight;
for Height := OldClientHeight downto 0 do ClientHeight := Height;
Application.ProcessMessages;
end;
end;
end;
end.
如果Form.Style:=bsSizeable
代码完美运行。
但是我Form.Style:=bsSingle
和我已经实现了它。
所以我尝试了自己的技巧并以其他方式编码如下:
procedure TForm1.WMNCLButtonDblClk(var msg: TWMNCLButtonDblClk);
var
Height : integer;
begin
if (Msg.HitTest = HTCAPTION) then
Caption := 'Double Click';
Form1.BorderStyle := bsSizeable;
begin
if (ClientHeight = 0) then
begin
for Height := 0 to OldClientHeight do ClientHeight := Height;
Application.ProcessMessages;
end
else
begin
OldClientHeight := ClientHeight;
for Height := OldClientHeight downto 0 do ClientHeight := Height;
Application.ProcessMessages;
end;
end;
Form1.BorderStyle := bsSingle;
end;
但我面临以下问题:
- 在
Rolling Down
ifDoubleBuffered:=true
时,Form.Background
变为Blue
(我的 Windows XP 主题为默认蓝色)然后变为clBtnFace
(我的Form.Background:=clBtnFace
)。还有一些闪烁。 - 在
Rolling Up
它没有完全卷起的时候,如果我使用我的技巧,一些表单背景是可见的。
请任何人给我解决方案,以便可以使用“bsSingle”表单样式完全上下滚动表单。