Forum > LCL
Resizing the forum is not working properly
Josh:
slight mod to your original code, note have made a constant to set minimum size of left right panel.
--- 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";}};} ---const Min_Panel_Width=60; procedure TForm1.LeftPanelResize(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin if DoResize and (x >= Min_Panel_Width) and (x<RightPanel.Left) then begin LeftPanel.Width := x; LeftPanel.Invalidate; end;end; procedure TForm1.RightPanelResize(Sender: TObject; Shift: TShiftState; X, Y: Integer);var Temp_Point:tpoint; New_Width:integer;begin if DoResize and (RightPanel.Width>=Min_Panel_Width) then // and (ssLeft in Shift) then begin Temp_Point:=screentoclient(mouse.CursorPos); if Temp_Point.x>LeftPanel.Width then begin New_Width:=RightPanel.Parent.Width-Temp_Point.x; if New_Width<Min_Panel_Width then New_Width:=Min_Panel_Width; RightPanel.SetBounds(Temp_Point.x,RightPanel.Top,New_Width,RightPanel.Height); RightPanel.Invalidate; end; end;end;
ps adjusted your form create tocreate panels with min width
--- 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.FormCreate(Sender: TObject);begin BorderStyle := bsNone; // Create a panel for left side resize LeftPanel := TPanel.Create(Self); with LeftPanel do begin Parent := Self; Align := alLeft; Width := Min_Panel_Width; Cursor := crSizeWE; OnMouseDown := @FormMouseDown; OnMouseMove := @LeftPanelResize; OnMouseUp := @FormMouseUp; color:=clGreen; end; // Create a panel for right side resize RightPanel := TPanel.Create(Self); with RightPanel do begin Parent := Self; Align := alRight; Width := Min_Panel_Width; Cursor := crSizeWE; OnMouseDown := @FormMouseDown; OnMouseMove := @RightPanelResize; OnMouseUp := @FormMouseUp; color:=clRed; end; OnResize := @FormResize;end;
Navigation
[0] Message Index
[*] Previous page