ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

Signature digitale   



L'auteur

Mike Gagnon
Canada Canada
Membre Simple
# 0000000025
enregistré le 14/10/2004

Gagnon Mike
Pointe Cla H9R 3K8
de la société Carver Technologies Inc.
Fiche personnelle


Note des membres
20/20
1 vote


Contributions > 05 - API et appels systèmes

Signature digitale
# 0000000972
ajouté le 07/11/2021 11:14:50 et modifié le 07/11/2021
consulté 5504 fois
Niveau initié

Version(s) Foxpro :
VFP 9.0
VFP 8.0
VFP 7.0

Description
Un example pour créer un signature digitale avec Foxpro. Cet API existe depuis Windows 7 (Auteur inconnu)
Code source :
LOCAL SP AS SignaturePad

m.SP = CREATEOBJECT("SignaturePad")
m.SP.Show(1)

DEFINE CLASS SignaturePad AS Form

  Height = 250
  Width = 400
  Caption = "Signature Pad"

  ADD OBJECT shpPad AS Shape WITH ;
    Top = 16, ;
    Left = 16, ;
    Height = 201, ;
    Width = 265, ;
    BackColor = RGB(255,255,255)

  ADD OBJECT cmdClear AS CommandButton WITH ;
    Top = 32, ;
    Left = 304, ;
    Height = 27, ;
    Width = 84, ;
    Caption = "Clear"

  ADD OBJECT cmdSave AS CommandButton WITH ;
    Top = 72, ;
    Left = 304, ;
    Height = 27, ;
    Width = 84, ;
    Caption = "Save"

  PROCEDURE shpPad.Init

    * prepare a ink pad
    LOCAL InkCollector AS MSInkAut.InkCollector
    LOCAL InkRectangle AS MSInkAut.InkRectangle

    m.InkCollector = CREATEOBJECT("MSInkAut.InkCollector.1")
    m.InkCollector.hWnd = Thisform.HWnd

    WITH m.InkCollector.defaultDrawingAttributes

      .Color = This.FillColor
      .Width = 100
      .PenTip = 0
      .AntiAliased = .T.
      .FitToCurve = .F.

    ENDWITH

    m.InkRectangle = CREATEOBJECT("MSInkAut.InkRectangle")

    * place the pad over the shape
    WITH m.InkRectangle

      .Left = This.Left
      .Top = This.Top
      .Right = This.Left + This.Width
      .Bottom = This.Top + This.Height

    ENDWITH

    m.InkCollector.SetWindowInputRectangle(m.InkRectangle)

    m.InkCollector.Enabled = .T.

    * and control it via the shape control
    This.AddProperty("InkCollector", m.InkCollector)

  ENDPROC

  PROCEDURE cmdClear.Click

    * delete stored ink strokes
    WITH Thisform.shpPad

      .InkCollector.Ink.DeleteStrokes()
      .Refresh()

    ENDWITH

  ENDPROC

  PROCEDURE cmdSave.Click

    LOCAL GIFContents AS String
    LOCAL SafetyStatus AS String

    m.SafetyStatus = SET("Safety")
    SET SAFETY OFF
    TRY
      m.GIFContents = Thisform.shpPad.InkCollector.Ink.Save(2)
      STRTOFILE(m.GIFContents, PUTFILE("Save""Signature""gif"))
    CATCH
    ENDTRY

    IF m.SafetyStatus == "ON"
      SET SAFETY ON
    ENDIF

  ENDPROC

ENDDEFINE
Commentaires
Aucun commentaire enregistré ...

Publicité

Les pubs en cours :


www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2024.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3