Unit cSnapToGrid

** 7/31/96 - Created by calix@together.net ** ** Just do the following : ** 1. add a panel to the form, ** 2. add the TSnapToGrid to the form, ** 3. assign the panel to the SnapControl property, ** 4. drop more panels inside the first panel, ** 5. run the form, ** 6. move/resize the contained panels. ** TSnapToGrid is a control with a SnapControl property. ** When the SnapControl property is set, the user can ** move all *WINDOWED* decendents of SnapControl at runtime. ** ** This control *ONLY* allows the user to move controls ** that decend from TWinControl and that are contained ** by SnapControl. ** ** I obtained all the information required to create this ** component from the Delphi32 source code and online help. ** ** 8/1/96 - Added control resizing ** 8/4/96 - Added DrawFocusRect property ** 8/11/96 - Added OnSelect event ** 8/18/96 - Changed OnSelect to OnMouseDown event ** 8/18/96 - Added OnMouseUp event ** 8/18/96 - Added OnMouseMove event ** 9/3/96 - Added Resizeable and Moveable properties

Classes

TSnapToGrid -

Functions

GetControl - -------------------------------------------------------} (* ** Given a Parent and a handle to a window, determine ** if the window is a descendent of the Parent.
Register - -------------------------------------------------------

Types

TGridSize
TMoveEvent

Constants

Variables

msgLast


Functions


function GetControl(Parent: TWinControl; Hwnd: Hwnd): TControl;

-------------------------------------------------------} (* ** Given a Parent and a handle to a window, determine ** if the window is a descendent of the Parent. ** If it is, return the child control.

procedure Register;

-------------------------------------------------------

Types


TGridSize = SmallInt

TMoveEvent = procedure (Sender: TObject; Shift: TShiftState; X, Y: Integer) of object

Constants


Variables

msgLast : TMessage