I am trying to resize a borderless form but when I increase the size using the right/bottom side, I get a gap between the border and the old client area that depends of the speed you move the mouse.
The effect is more noticeable when you resize from the left border or even from the bottomleft corner, it's horrible everywhere (I tried with other commercial apps and it happens as well). This effect happens as well when I change to sizable border, but it's not as awful as when I remove form borders
The form layout consists in a top panel doing the title bar function (with some tImages and buttons), and some other panels showing other info (like a memo, other controls, etc)
There's a snip of my code where I capture the mouse button and send a message to windows, but I also tried to do it manually with the similar results
Activating the double buffer for the top panel avoids flickering, but resizing the panel is not synchronized with form resizing, thus appearing a gap, or part of the panel disapearing
procedure TOutputForm.ApplicationEvents1Message( var Msg: tagMSG;
var Handled: Boolean );
const
BorderBuffer = 5;
var
X, Y: Integer;
ClientPoint: TPoint;
direction: integer;
begin
Handled := false;
case Msg.message of
WM_LBUTTONDOWN:
begin
if fResizable then
begin
if fSides = [sTop] then
direction := 3
else if fSides = [sLeft] then
direction := 1
else if fSides = [sBottom] then
direction := 6
else if fSides = [sRight] then
direction := 2
else if fSides = [sRight, sTop] then
direction := 5
else if fSides = [sLeft, sTop] then
direction := 4
else if fSides = [sLeft, sBottom] then
direction := 7
else if fSides = [sRight, sBottom] then
direction := 8;
ReleaseCapture;
SendMessage( Handle, WM_SYSCOMMAND, ( 61440 + direction ), 0 );
Handled := true;
end;
end;
WM_MOUSEMOVE:
begin
// Checks the borders and sets fResizable to true if it's in a "border"
// ...
end; // mousemove
end; // case
end;
How could I avoid that area and/or force windows to be redrawn? I am using Delphi but a generic solution (or in other language) or even a direction to go forward would be fine for me
Thank you in advance
Sleep(250)
into the OnResize event handler. Show us your resize code. – TunnelSC_SIZE
andWMSZ_LEFT
,WMSZ_RIGHT
, ... constants.. – Agar