*------------------------------------- *-- Program: InkOl1.prg *-- *-- Author: Mike Stewart *-- Comments: Simple InkOverlay demo using an InkOverlay class with a recognizer button. *------------------------------------- PUBLIC oform1 oform1=NEWOBJECT("InkOverlayDemo1") oform1.Show RETURN DEFINE CLASS InkOverlayDemo1 AS form Top = 0 Left = 0 Height = 416 Width = 659 DoCreate = .T. Caption = "Form1" Name = "Form1" ADD OBJECT inkRecognize AS Commandbutton WITH ; Top = 368, ; Left = 20, ; Caption = "\<Recognize ", ; Name = "Inkbutton1" ADD OBJECT edtrecognized AS editbox WITH ; Height = 121, ; Left = 20, ; Top = 236, ; Width = 589, ; Name = "edtRecognized" ADD OBJECT cmdSave AS commandbutton WITH ; Top = 360, ; Left = 357, ; Height = 27, ; Width = 84, ; Caption = "\<Save", ; Name = "cmdSave" PROCEDURE cmdSave.Click lsInk = ThisForm.inkoverlay.Ink.Save() STRTOFILE(lsInk, GETFILE("isf")) ENDPROC Procedure SetRectangle LOCAL oInkRectangle as MSINKAUT.inkrectangle oInkrectangle = NEWOBJECT("msinkaut.inkrectangle") *-- Set the bottom of the rectangle *-- to be the top of the editbox. *-- Doing this means the InkOverlay *-- will not overlap our controls. oInkRectangle.Bottom = thisform.edtRecognized.Top *-- The rest of the dimensions of the *-- rectangle will match those of the *-- form. oinkrectangle.Top = thisform.Top oinkrectangle.Left = thisform.Left oinkrectangle.Right = thisform.Width - thisform.Left *-- Call the method by passing our InkRectangle *-- and we're done. ****ThisForm.inkoverlay.SetWindowInputRectangle(oInkRectangle) ENDPROC PROCEDURE Init PUBLIC oink As msinkaut.inkoverlay.1 oInk = NEWOBJECT("msinkaut.inkoverlay.1") WITH oInk *-- Point it to the window for which you *-- want to capture ink. Because VFP does *-- not have hWnds for individual controls, *-- this can only be done at the form level. .hwnd = thisform.HWnd *-- The Attachmode property determines whether the InkOverlay sits in front *-- or behind the controls on the form. .AttachMode = 1 && IOAM_InFront this.setrectangle *-- Set everything before enabling, or else error occurs. .enabled = 1 *-- Set to collect both ink and gestures **** this was set to 2 originally ~M .CollectionMode = 0 && ICM_InkAndGesture ENDWITH ENDPROC ENDDEFINE