Forum > LCL
Resizing the forum is not working properly
khichi:
Hello everyone, I am trying to resize the form / window for which the BorderStyle value is set to bsNone, On right panel the resize is working as expected, but on left side / panel, the resize does not works as expected, the window flickers on resize and the resize operation is not smooth. Kindly help me to fix this.
I have attached the zip file with code and project settings, however, I am also reproducing the code for left & right panel resize:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.LeftPanelResize(Sender: TObject; Shift: TShiftState; X, Y: Integer);var NewWidth: Integer;begin NewWidth := (Left+Width) - Mouse.CursorPos.X + RightPanel.Width; if (NewWidth > 60) then begin Left := Left + Width - NewWidth; Width := NewWidth; end;end; procedure TForm1.RightPanelResize(Sender: TObject; Shift: TShiftState; X, Y: Integer);var NewWidth: Integer;begin if DoResize and (ssLeft in Shift) then begin SetBounds(Left, Top, Width + X - DownX, Height); //DownX := X; end; end;
Thanks in advance for you help.
Pe3s:
Hello, read my previous post, it may come in handy. Regards
https://forum.lazarus.freepascal.org/index.php/topic,60383.msg451366.html#msg451366
KodeZwerg:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1; {$mode objfpc}{$H+} interface uses Windows , Classes , SysUtils , Forms , Controls , Graphics , Dialogs , ExtCtrls; type { TForm1 } TForm1 = class(TForm) pnlRight: TPanel; pnlLeft: TPanel; procedure pnlMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X , Y: Integer); procedure pnlMouseMove(Sender: TObject; Shift: TShiftState; X , Y: Integer); procedure pnlMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X , Y: Integer); strict private private public end; var Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.pnlMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X , Y: Integer);begin if (Button <> mbLeft) then Exit; SetCapture(TWinControl(Sender).Handle);end; procedure TForm1.pnlMouseMove(Sender: TObject; Shift: TShiftState; X , Y: Integer);var newPos: TPoint; tmpL: Integer;begin tmpL := Left; if ssLeft in Shift then begin Screen.Cursor := crSizeWE; if (Sender = pnlLeft) then begin GetCursorPos(newPos); Left := newPos.X; Width := Width - Left + tmpL; end else begin newPos := ScreenToClient(Mouse.CursorPos); Width := newPos.X; end; Invalidate; end;end; procedure TForm1.pnlMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X , Y: Integer);begin if (Button <> mbLeft) then Exit; Screen.Cursor := crDefault; ReleaseCapture;end; end.My try, haven't tested yours, neither tried earlier to-do such but this came out. Maybe it help maybe it's crap :-[
khichi:
Thanks Pe3s & KodeZwerg, I have tried the provided solutions but the result is same,
howardpc:
Try the attached project, adapted from yours.
On Windows at least, it shows no flicker.
Navigation
[0] Message Index
[#] Next page