Guidance
指路人
g.yi.org
software / rapidq / Examples / QObject / Object / QDrawFocus.inc

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'=======================================================
' Type Objet
' Classe QDrawFocus Version 1.2
'=======================================================
     $IFNDEF TRUE
      $DEFINE True 1
     $ENDIF

     $IFNDEF FALSE
      $DEFINE False 0
     $ENDIF

     $IFNDEF boolean
      $DEFINE boolean INTEGER
     $ENDIF

     DECLARE FUNCTION DrawFocusRect LIB "user32" ALIAS "DrawFocusRect" (hdc AS LONG,lpRect AS QRECT) AS LONG

     TYPE QDrawFocus EXTENDS QOBJECT
  '===================================================
  ' champs objet
  '===================================================
PUBLIC:
      Left AS SHORT PROPERTY SET SetLeft
      Top AS SHORT PROPERTY SET SetTop
      Width AS SHORT PROPERTY SET SetWidth
      Height AS SHORT PROPERTY SET SetHeight
      Move AS boolean PROPERTY SET SetMove
      Visible AS boolean
      Inside AS boolean PROPERTY SET SetInside
      NoResize AS boolean
      ShowCursor AS boolean
PRIVATE:
      Border AS SHORT
      Frame1 AS boolean
      Frame2 AS boolean
      Frame3 AS boolean
      offsetX AS SHORT
      offsetY AS SHORT
      rect AS QRECT

PUBLIC:
  '==========================================
  ' Proprieté left en lecture seule
  '==========================================
      PROPERTY SET SetLeft(value AS SHORT)
      END PROPERTY

  '==========================================
  ' Proprieté top en lecture seule
  '==========================================
      PROPERTY SET SetTop(value AS SHORT)
      END PROPERTY

  '==========================================
  ' Proprieté width en lecture seule
  '==========================================
      PROPERTY SET SetWidth(value AS SHORT)
      END PROPERTY

  '==========================================
  ' Proprieté height en lecture seule
  '==========================================
      PROPERTY SET SetHeight(value AS SHORT)
      END PROPERTY

  '==========================================
  ' Proprieté move en lecture seule
  '==========================================
      PROPERTY SET SetMove(value AS boolean)
      END PROPERTY

  '==========================================
  ' Proprieté inside en lecture seule
  '==========================================
      PROPERTY SET SetInside(value AS boolean)
      END PROPERTY

  '==========================================
  ' Méthode:supprime le focus
  ' Parametres:
  ' handle:(handle DC)
  '==========================================
      SUB Remove(handle AS LONG)
    ' remove focus
       IF QDrawFocus.Visible THEN
        QDrawFocus.rect.right=QDrawFocus.left+QDrawFocus.width
        QDrawFocus.rect.bottom=QDrawFocus.top+QDrawFocus.height
        QDrawFocus.rect.left=QDrawFocus.left
        QDrawFocus.rect.top=QDrawFocus.top
        DrawFocusRect(handle,QDrawFocus.rect)
        QDrawFocus.Visible=false
       END IF
       IF QDrawFocus.ShowCursor THEN Screen.Cursor=0
      END SUB

  '============================================
  ' Méthode:debut du focus
  ' Parametres:
  ' handle:(handle DC)
  ' x,y:(position x,y)
  '============================================
      SUB Start(handle AS LONG,x AS INTEGER,y AS INTEGER)
    ' click on focus
       QDrawFocus.Inside=false
       QDrawFocus.Move=false
       IF x>QDrawFocus.left AND x<QDrawFocus.left+QDrawFocus.width AND y>QDrawFocus.top AND y<QDrawFocus.top+QDrawFocus.height AND QDrawFocus.Visible=true THEN
        QDrawFocus.Inside=true
       ELSE
        QDrawFocus.Remove(handle)
        QDrawFocus.Inside=false
        QDrawFocus.Move=false
        QDrawFocus.left=x
        QDrawFocus.top=y
        QDrawFocus.rect.left=x
        QDrawFocus.rect.top=y
        IF QDrawFocus.ShowCursor THEN Screen.Cursor=-3
       END IF
       IF QDrawFocus.Inside AND QDrawFocus.Visible THEN
        QDrawFocus.Frame1=false
        QDrawFocus.Frame2=false
        QDrawFocus.Frame3=false
        QDrawFocus.offsetX=x-QDrawFocus.left
        QDrawFocus.offsetY=y-QDrawFocus.top
        IF x>QDrawFocus.left+QDrawFocus.width-QDrawFocus.Border AND x<QDrawFocus.left+QDrawFocus.width AND y>QDrawFocus.top+QDrawFocus.height-QDrawFocus.Border AND y<QDrawFocus.top+QDrawFocus.height AND QDrawFocus.NoResize=false THEN
         QDrawFocus.Frame3=true
         IF QDrawFocus.ShowCursor THEN Screen.Cursor=-8
        ELSEIF y>QDrawFocus.top+QDrawFocus.height-QDrawFocus.Border AND y<QDrawFocus.top+QDrawFocus.height AND QDrawFocus.NoResize=false THEN
         QDrawFocus.Frame2=true
         IF QDrawFocus.ShowCursor THEN Screen.Cursor=-7
        ELSEIF x>QDrawFocus.left+QDrawFocus.width-QDrawFocus.Border AND x<QDrawFocus.left+QDrawFocus.width AND QDrawFocus.NoResize=false THEN
         QDrawFocus.Frame1=true
         IF QDrawFocus.ShowCursor THEN Screen.Cursor=-9
        ELSE
         IF QDrawFocus.ShowCursor THEN Screen.Cursor=-21
        END IF
       END IF
      END SUB

  '==========================================
  ' Méthode:dessine le focus
  ' Parametres:
  ' handle:(handle DC)
  ' x,y:(position x,y)
  ' flagDraw:(dessin focus si true)
  '==========================================
      SUB Draw(handle AS LONG,x AS INTEGER,y AS INTEGER,flagDraw AS boolean)
    ' move focus
       IF flagDraw THEN
        IF QDrawFocus.Visible THEN
         QDrawFocus.rect.right=QDrawFocus.left+QDrawFocus.width
         QDrawFocus.rect.bottom=QDrawFocus.top+QDrawFocus.height
         QDrawFocus.rect.left=QDrawFocus.left
         QDrawFocus.rect.top=QDrawFocus.top
         DrawFocusRect(handle,QDrawFocus.rect)
        END IF
        IF QDrawFocus.Inside AND QDrawFocus.Visible THEN
         IF QDrawFocus.Frame1 AND QDrawFocus.NoResize=false THEN
          QDrawFocus.rect.right=x
          QDrawFocus.rect.bottom=QDrawFocus.top+QDrawFocus.height
          QDrawFocus.width=x-QDrawFocus.left
         END IF
         IF QDrawFocus.Frame2 AND QDrawFocus.NoResize=false THEN
          QDrawFocus.rect.bottom=y
          QDrawFocus.rect.right=QDrawFocus.left+QDrawFocus.width
          QDrawFocus.height=y-QDrawFocus.top
         END IF
         IF QDrawFocus.Frame3 AND QDrawFocus.NoResize=false THEN
          QDrawFocus.rect.right=x
          QDrawFocus.rect.bottom=y
          QDrawFocus.width=x-QDrawFocus.left
          QDrawFocus.height=y-QDrawFocus.top
         END IF
         IF QDrawFocus.Frame1=false AND QDrawFocus.Frame2=false AND QDrawFocus.Frame3=false THEN
          QDrawFocus.left=x-QDrawFocus.offsetX
          QDrawFocus.top=y-QDrawFocus.offsetY
          QDrawFocus.rect.left=QDrawFocus.left
          QDrawFocus.rect.top=QDrawFocus.top
          QDrawFocus.rect.right=x-QDrawFocus.offsetX+QDrawFocus.width
          QDrawFocus.rect.bottom=y-QDrawFocus.offsetY+QDrawFocus.height
         END IF
         DrawFocusRect(handle,QDrawFocus.rect)
         QDrawFocus.Move=true
         QDrawFocus.Visible=true
        ELSE
         QDrawFocus.width=x-QDrawFocus.left
         QDrawFocus.height=y-QDrawFocus.top
         QDrawFocus.rect.right=x
         QDrawFocus.rect.bottom=y
         DrawFocusRect(handle,QDrawFocus.rect)
         QDrawFocus.Visible=true
        END IF
       ELSE
      ' show cursor focus
        IF QDrawFocus.Visible THEN
         IF x>QDrawFocus.left+QDrawFocus.width-QDrawFocus.Border AND x<QDrawFocus.left+QDrawFocus.width AND y>QDrawFocus.top+QDrawFocus.height-QDrawFocus.Border AND y<QDrawFocus.top+QDrawFocus.height AND QDrawFocus.NoResize=false THEN
          QDrawFocus.Inside=true
          IF QDrawFocus.ShowCursor THEN Screen.Cursor=-8
         ELSEIF x>QDrawFocus.left AND x<QDrawFocus.left+QDrawFocus.width AND y>QDrawFocus.top+QDrawFocus.height-QDrawFocus.Border AND y<QDrawFocus.top+QDrawFocus.height AND QDrawFocus.NoResize=false THEN
          QDrawFocus.Inside=true
          IF QDrawFocus.ShowCursor THEN Screen.Cursor=-7
         ELSEIF x>QDrawFocus.left+QDrawFocus.width-QDrawFocus.Border AND x<QDrawFocus.left+QDrawFocus.width AND y>QDrawFocus.top AND y<QDrawFocus.top+QDrawFocus.height AND QDrawFocus.NoResize=false THEN
          QDrawFocus.Inside=true
          IF QDrawFocus.ShowCursor THEN Screen.Cursor=-9
         ELSEIF x>QDrawFocus.left AND x<QDrawFocus.left+QDrawFocus.width-QDrawFocus.Border AND y>QDrawFocus.top AND y<QDrawFocus.top+QDrawFocus.height-QDrawFocus.Border THEN
          QDrawFocus.Inside=true
          IF QDrawFocus.ShowCursor THEN Screen.Cursor=-21
         ELSE
          QDrawFocus.Inside=false
          IF QDrawFocus.ShowCursor THEN Screen.Cursor=0
         END IF
        END IF
       END IF
      END SUB

  '==========================================
  ' Méthode:arrete le dessin du focus
  ' Parametres:
  ' handle:(handle DC)
  ' flagRemove:(suppression focus)
  '==========================================
      SUB Stop(handle AS LONG,flagRemove AS boolean)
    ' click off focus
       IF QDrawFocus.Move AND flagRemove THEN
        QDrawFocus.Remove(handle)
       END IF
       IF QDrawFocus.ShowCursor THEN Screen.Cursor=0
      END SUB

      CONSTRUCTOR
       Border=10
       ShowCursor=true
      END CONSTRUCTOR
     END TYPE
掌柜推荐
 
 
¥289.00 ·
 
 
¥1,080.00 ·
 
 
¥1,380.00 ·
 
 
¥638.00 ·
 
 
¥1,290.00 ·
 
 
¥1,420.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-01-03 17:35:08