Ok, found a way but after each "snap" it has some offset more and more.
Make new project, drop a drawgrid to it, set its DefaultRowHeight to 64, DefaultColWidth to 64. No fixedcols or rows.
Add this to private section of Form1:
Code:
procedure WMWindowPosChanging (var Msg: TWMWindowPosMsg); message WM_WINDOWPOSCHANGING;
And this in implementation:
Code:
procedure TForm1.WMWindowPosChanging(var Msg: TWMWindowPosChanging);
begin
if (Msg.WindowPos^.flags and SWP_NOSIZE = 0) and ((Msg.WindowPos^.cx <> Width)
or (Msg.WindowPos^.cy <> Height))
then
begin
Msg.WindowPos^.cx:=(Msg.WindowPos^.cx div 70)*70;
Msg.WindowPos^.cy:=(Msg.WindowPos^.cy div 70)*70;
end;
end;
Resize the form..
The less columns or rows then the bigger offset gets.
Maybe scollbars and grid line width is making troubles here, dunno.
Any ideas?
EDIT: Found another solution:
https://groups.google.com/forum/#!to...pi/39tMGvqXjog
I used ValueListEditor and if i set the INC_SIZE to DefaultRowHeight of the ValueListEditor, then there is no offset problem.
But it still shows the small portion of item below the current last visible row.
If i change the INC_SIZE to smaller or bigger i get the offset bug right away after resizing.
Bookmarks