Results 1 to 10 of 10

Thread: "Snapped" form resize like in Delphi 7 Object Inspector

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Thanks you for this!
    You forgot to declare VerticalBorderHeight.

    But why the bottom part flickers so much? The right side seems ok, but bottom part is flickering.
    The form wants to resize but it cant and flickers.

    Even if i set doublebuffered to true and comment out the grid drawing.

    EDIT
    I downloaded some old free open source Delphi Object Inspector "clone" for Delphi 3 and it had the snapping in it.

    Drop a DrawGrid on form, set fixedcols,fixedrows to 0, defaultcolwidth to 64, defaultrowheight to 64. Thats the tilesize i use.
    And set Align of DrawGrid1 to alClient.

    Code:
    // Add this to private section of Form1
    Procedure WhileSizing(Var msg : tmessage);  Message WM_SIZING;
    
    
    procedure TForm1.WhileSizing(var msg: tmessage);
    
    var PR : PRect;                              { Makes it so there's never half }
         Offset, offset2 : Integer;                        { a row showing in the listbox. }
         Growing : Boolean;
         Top, left : Boolean;
         Lb :tdrawgrid;
    Begin
     Lb := DrawGrid1;
      if not (msg.wparam in [wmsz_top, wmsz_topleft, wmsz_topright,
                             wmsz_bottom, wmsz_bottomleft, wmsz_bottomright]) then exit;
      pr := Pointer(msg.Lparam);
      if (pr.bottom - pr.top) = height then exit;
      msg.result:= 1;
    
      OffSet := ((pr.bottom - pr.top) - (height - Lb.clientheight)) mod lb.DefaultRowHeight;
      Growing := (pr.bottom - pr.top) > height;
      top := msg.wparam in [wmsz_top, wmsz_topleft, wmsz_topright];
      //left := msg.WParam in [wmsz_bottom, wmsz_bottomleft, wmsz_bottomright ];
    
      if top then Begin
        if growing then
          pr.top := pr.top + offset
        else
          pr.top := pr.top - (lb.DefaultRowHeight  - offset);
      End Else Begin
        if Growing then
          pr.bottom := pr.Bottom - offset
        else
          pr.bottom := pr.bottom + (lb.DefaultRowHeight  - offset);
      End;
    
    end;
    It works the way i need, but i must make this work for right side also.
    If anybody would like to help with this, then please.

    Atm im watching and reading that code, because i dont understand everything in it.
    If i would know i would convert it by myself.

    I probably have to take piece of paper and pencil and calculate everything on that until i get it. Then i should be able to convert it to left and right side resizing.
    Last edited by hwnd; 08-09-2013 at 09:42 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •