DEFINE CLASS test AS form DoCreate = .T. Caption = "Form1" chorizontal = "" cvertical = "" Name = "Form1" lresizing = .F. ADD OBJECT shape1 AS shape WITH ; Top = 41, ; Left = 62, ; Height = 61, ; Width = 107, ; Name = "Shape1" PROCEDURE shape1.MouseDown LPARAMETERS nButton, nShift, nXCoord, nYCoord *** Check for left mouse button IF nButton = 1 *** Now see if we are on a border of the shape IF BETWEEN( nXCoord, This.Left - 2, This.Left + 2 ) OR ; BETWEEN( nXCoord, This.Left + This.Width - 2, This.Left + This.Width + 2 ) IF BETWEEN( nXCoord, This.Left - 2, This.Left + 2 ) Thisform.cHorizontal = 'LEFT' ELSE Thisform.cHorizontal = 'RIGHT' ENDIF ELSE Thisform.cHorizontal = '' ENDIF IF BETWEEN( nYCoord, This.Top - 2, This.Top + 2 ) OR ; BETWEEN( nYCoord, This.Top + This.Height - 2, This.Top + This.Height + 2 ) IF BETWEEN( nYCoord, This.Top - 2, This.Top + 2 ) Thisform.cVertical = 'TOP' ELSE Thisform.cVertical = 'BOTTOM' ENDIF ELSE Thisform.cVertical = '' ENDIF *** If we are resizing, change the cursor IF EMPTY( Thisform.cHorizontal ) AND EMPTY( Thisform.cVertical ) Thisform.lResizing = .F. ELSE Thisform.lResizing = .T. *** Now set the mouse pointer This.MousePointer = 5 && size ENDIF ENDIF ENDPROC PROCEDURE shape1.MouseMove LPARAMETERS nButton, nShift, nXCoord, nYCoord LOCAL lnRight, lnBottom IF Thisform.lResizing IF Thisform.cHorizontal == 'LEFT' lnRight = This.Left + This.Width This.Left = nXCoord *** error checking needed here to ensure width does *** not get too small This.Width = ABS( lnRight - This.Left ) ELSE IF Thisform.cHorizontal = 'RIGHT' *** need a check here for legal movement This.Width = ABS( nXCoord - This.Left ) ENDIF ENDIF IF Thisform.cVertical == 'TOP' lnBottom = This.Top + This.Height This.Top = nYCoord *** error checking needed here to ensure height does *** not get too small This.Height = ABS( lnBottom - This.Top ) This.Top = nYCoord ELSE IF Thisform.cVertical = 'BOTTOM' *** need a check here for legal movement This.Height = ABS( nYCoord - This.Top ) ENDIF ENDIF ENDIF ENDPROC PROCEDURE shape1.MouseUp LPARAMETERS nButton, nShift, nXCoord, nYCoord IF nButton = 1 IF Thisform.lResizing Thisform.lResizing = .F. Thisform.cVertical = '' Thisform.cHorizontal = '' This.MousePointer = 0 ENDIF ENDIF ENDPROC ENDDEFINE