Guidance
指路人
g.yi.org
software / rapidq / Examples / QObject / QTButton / QTButton_NewFullExample.bas

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

  
'-- Différentes possibilités/A more complete examples
     $RESOURCE btn_BMP AS "Boutons.bmp"' -- Remplacez-le par une image que vous possèdez
     $RESOURCE btn_BMP1 AS "Boutons_Plat.bmp"' -- Utiliser celui-ci pour créer un bouton
                                        '    plat.

     DIM ico_BMP AS QBITMAP
     WITH ico_BMP
      .Width = 18
      .Height = 18
      .Circle (1,1,17,17, -1, &HFFAADD)
      .Line(6,4,6,7,0)
      .Line(7,4,7,7,0)
      .Line(10,4,10,7,0)
      .Line(11,4,11,7,0)
      .Line(5,10,5,10,0)
      .Line(12,10,12,10,0)
      .Line(4,9,4,9,0)
      .Line(13,9,13,9,0)
      .Line(6,11,11,11,0)
     END WITH

     $INCLUDE "QTButton92.inc"' -- Corrigez le chemin si nécessaire
'QTBtnBMP.BMPHandle = btn_BMP1

     DECLARE SUB Boutons_Click(Sender AS QTButton)
     DECLARE SUB TBoutons_MouseMove(X AS INTEGER, Y AS INTEGER, Shift AS INTEGER, Sender AS QTButton)
     DECLARE SUB Bouton_MouseMove(X AS INTEGER, Y AS INTEGER, Shift AS INTEGER, Sender AS QBUTTON)
     DECLARE SUB Bouton_MouseUp(btn AS INTEGER, X AS INTEGER, Y AS INTEGER, Shift AS INTEGER, Sender AS QBUTTON)

     DECLARE SUB Enjolivure_Click(Sender AS QTButton)
     DECLARE SUB TabChange_Click(Sender AS QTButton)

     DIM Bitmap AS QBITMAP

     CREATE Form AS QFORM
      CAPTION = "Examples de QTButton Examples"
      Width = 393
      Height = 394
      Center
      CREATE Label1 AS QLABEL
       CAPTION = "DrawCount : "
       Left = 8
       Top = 336
       Width = 120
       Transparent = 1
      END CREATE
      CREATE Panel1 AS QPANEL
       Alignment = 0
       Left = 0
       Top = 0
       CAPTION = "   Barre d'outil"
       Width = 385
       Height = 33
       Align = 1
       CREATE Panel2 AS QPANEL
        Left = 3
        Top = 4
        Width = 3
        Height = 26
       END CREATE
       CREATE Button6 AS QTBUTTON
        BMP = ico_BMP.BMP
        NumBMPs = 4
        Left = 75
        Top = 4
        Width = 25
        GroupIndex = 1
        XPThemeBtnType = xpt_toolbarbtn
        TabOrder = 1
        OnMouseEnter = TBoutons_MouseMove
        OnMouseLeave = TBoutons_MouseMove
       END CREATE
       CREATE Button7 AS QTBUTTON
        BMP = ico_BMP.BMP
        NumBMPs = 4
        Left = 104
        Top = 4
        Width = 25
        GroupIndex = 1
        XPThemeBtnType = xpt_toolbarbtn
        TabOrder = 2
        OnMouseEnter = TBoutons_MouseMove
        OnMouseLeave = TBoutons_MouseMove
       END CREATE
       CREATE Panel3 AS QPANEL
        Left = 136
        Top = 4
        Width = 2
        Height = 25
        BevelInner = 1
        BevelOuter = 0
        TabOrder = 3
       END CREATE
       CREATE Button8 AS QTBUTTON
        CAPTION = "Style XP"
        NumBMPs = 4
        Left = 144
        Top = 4
        Width = 67
        GroupIndex = 2
        XPThemeBtnType = xpt_toolbarbtn
        Down = True
        TabOrder = 4
        OnClick = Enjolivure_Click
        OnMouseEnter = TBoutons_MouseMove
        OnMouseLeave = TBoutons_MouseMove
       END CREATE
       CREATE Button9 AS QTBUTTON
        CAPTION = "#1"
        NumBMPs = 4
        Left = 216
        Top = 4
        Width = 43
        GroupIndex = 2
        XPThemeBtnType = xpt_toolbarbtn
        TabOrder = 5
        OnClick = Enjolivure_Click
        OnMouseEnter = TBoutons_MouseMove
        OnMouseLeave = TBoutons_MouseMove
       END CREATE
       CREATE Button10 AS QTBUTTON
        CAPTION = "#2"
        NumBMPs = 4
        Left = 264
        Top = 4
        Width = 43
        GroupIndex = 2
        XPThemeBtnType = xpt_toolbarbtn
        TabOrder = 6
        OnClick = Enjolivure_Click
        OnMouseEnter = TBoutons_MouseMove
        OnMouseLeave = TBoutons_MouseMove
       END CREATE
       CREATE Button11 AS QTBUTTON
        CAPTION = "Mélangé"
        NumBMPs = 4
        Left = 312
        Top = 4
        Width = 67
        GroupIndex = 2
        XPThemeBtnType = xpt_toolbarbtn
        TabOrder = 6
        OnClick = Enjolivure_Click
        OnMouseEnter = TBoutons_MouseMove
        OnMouseLeave = TBoutons_MouseMove
       END CREATE
      END CREATE
      CREATE Panel4 AS QPANEL
       Left = 8
       Top = 72
       Width = 369
       Height = 249
       BevelWidth = False
       COLOR = -2147483632
       TabOrder = 8
       CREATE Panel5 AS QPANEL
        Left = 1
        Top = 1
        Width = 367
        Height = 247
        BevelWidth = False
        COLOR = &HFFFFFF
        TabOrder = 3
        CREATE Image1 AS QIMAGE
         Left = 8
         Top = 160
         Height = 81
         AutoSize = True
        END CREATE
        CREATE Label2 AS QLABEL
         CAPTION = "Image Bitmap du bouton / button bitmap :"
         Left = 8
         Top = 144
         Width = 216
         Transparent = 1
        END CREATE
        CREATE Button12 AS QBUTTON
         CAPTION = "Classique"
         Left = 8
         Top = 8
         OnMouseMove = Bouton_MouseMove
        END CREATE
        CREATE Button13 AS QTBUTTON
         CAPTION = "Normal"
         NumBMPs = 4
         Left = 8
         Top = 40
         TabOrder = 4
         OnMouseEnter = TBoutons_MouseMove
         OnMouseLeave = TBoutons_MouseMove
        END CREATE
        CREATE Button14 AS QBUTTON
         CAPTION = "&Sous-ligné"
         Left = 88
         Top = 8
         TabOrder = 1
         OnMouseMove = Bouton_MouseMove
        END CREATE
        CREATE Button15 AS QTBUTTON
         CAPTION = "&Sous-ligné"
         NumBMPs = 4
         Left = 88
         Top = 40
         TabOrder = 5
         OnMouseEnter = TBoutons_MouseMove
         OnMouseLeave = TBoutons_MouseMove
        END CREATE
        CREATE Button16 AS QBUTTON
         BMP = ico_BMP.BMP
         CAPTION = "Bitmap"
         Left = 168
         Top = 8
         TabOrder = 2
         OnMouseMove = Bouton_MouseMove
        END CREATE
        CREATE Button17 AS QTBUTTON
         BMP = ico_BMP.BMP
         CAPTION = "Bitmap"
         NumBMPs = 4
         Left = 168
         Top = 40
         TabOrder = 6
         OnMouseEnter = TBoutons_MouseMove
         OnMouseLeave = TBoutons_MouseMove
        END CREATE
        CREATE Button18 AS QBUTTON
         CAPTION = "Désactivé"
         Enabled = False
         Left = 248
         Top = 8
         TabOrder = 3
         OnMouseMove = Bouton_MouseMove
        END CREATE
        CREATE Button19 AS QTBUTTON
         CAPTION = "Désactivé"
         NumBMPs = 4
         Enabled = False
         Left = 248
         Top = 40
         TabOrder = 7
         OnMouseEnter = TBoutons_MouseMove
         OnMouseLeave = TBoutons_MouseMove
        END CREATE
        CREATE Button20 AS QBUTTON
         CAPTION = "Multi-ligne\nRataillé\nMulti-Lines"
         Left = 8
         Top = 72
         Height = 57
         TabOrder = 8
         OnMouseMove = Bouton_MouseMove
        END CREATE
        CREATE Button21 AS QTBUTTON
         CAPTION = "Multi-ligne\nRataillé\nMulti-Lines"
         NumBMPs = 4
         Left = 88
         Top = 72
         Height = 57
         TabOrder = 9
         OnMouseEnter = TBoutons_MouseMove
         OnMouseLeave = TBoutons_MouseMove
        END CREATE
       END CREATE
       CREATE Panel6 AS QPANEL
        Left = 1
        Top = 1
        Width = 367
        Height = 247
        BevelWidth = False
        COLOR = &HFFFFFF
        TabOrder = 7
        Visible = False
        CREATE Label3 AS QLABEL
         CAPTION = "Ouvrir un dossier... :"
         Left = 8
         Top = 8
         Width = 104
         Transparent = 1
        END CREATE
        CREATE Edit1 AS QEDIT
         Text = "..."
         Left = 8
         Top = 24
        END CREATE
        CREATE Button22 AS QTBUTTON
         CAPTION = "..."
         NumBMPs = 4
         Left = 128
         Top = 24
         Width = 21
         Height = 21
         TabOrder = 1
         OnMouseEnter = TBoutons_MouseMove
         OnMouseLeave = TBoutons_MouseMove
        END CREATE
        CREATE Button23 AS QTBUTTON
         BMP = ico_BMP.BMP
         NumBMPs = 4
         Left = 160
         Top = 24
         Width = 21
         Height = 21
         TabOrder = 2
         OnMouseEnter = TBoutons_MouseMove
         OnMouseLeave = TBoutons_MouseMove
        END CREATE
        CREATE Button24 AS QTBUTTON
         FlickeringTrick = True
         CAPTION = "FlickeringTrick"
         NumBMPs = 4
         Left = 8
         Top = 48
         TabOrder = 4
         OnMouseEnter = TBoutons_MouseMove
         OnMouseLeave = TBoutons_MouseMove
        END CREATE
        CREATE Button25 AS QTBUTTON
         Height = 38
         Width = 104
         HideFocusRect = True
         CAPTION = "Masque le focus"
         NumBMPs = 4
         Left = 4 '8
         Top = 76 '80
         TabOrder = 4
         OnMouseEnter = TBoutons_MouseMove
         OnMouseLeave = TBoutons_MouseMove
        END CREATE
       END CREATE
      END CREATE
      CREATE Button1 AS QTBUTTON
       CAPTION = "Onglet1"
       NumBMPs = 4
       Left = 8
       Top = 48
       GroupIndex = 1
       XPThemeBtnType = xpt_tabbtn
       Down = True
       TabOrder = 1
       OnClick = TabChange_Click
       OnMouseEnter = TBoutons_MouseMove
       OnMouseLeave = TBoutons_MouseMove
      END CREATE
      CREATE Button2 AS QTBUTTON
       CAPTION = "Onglet2"
       NumBMPs = 4
       Left = 88
       Top = 48
       GroupIndex = 1
       XPThemeBtnType = xpt_tabbtn
       TabOrder = 2
       OnClick = TabChange_Click
       OnMouseEnter = TBoutons_MouseMove
       OnMouseLeave = TBoutons_MouseMove
      END CREATE
      CREATE Button3 AS QTBUTTON
       CAPTION = "Onglet3"
       NumBMPs = 4
       Enabled = False
       Left = 168
       Top = 48
       GroupIndex = 1
       XPThemeBtnType = xpt_tabbtn
       TabOrder = 2
       OnClick = TabChange_Click
       OnMouseEnter = TBoutons_MouseMove
       OnMouseLeave = TBoutons_MouseMove
      END CREATE
      CREATE Button4 AS QBUTTON
       Kind = 2
       CAPTION = "Annuler"
       Left = 296
       Top = 328
       TabOrder = 5
       OnMouseMove = Bouton_MouseMove
      END CREATE
      CREATE Button5 AS QTBUTTON
       Kind = 1
       CAPTION = "OK"
       NumBMPs = 4
       Left = 216
       Top = 328
       TabOrder = 4
       Default = 1
       OnMouseEnter = TBoutons_MouseMove
       OnMouseLeave = TBoutons_MouseMove
      END CREATE
     END CREATE

     DIM curSkin AS INTEGER, _
      XPThemeEnabled AS INTEGER
     IF isXP_QTBtn = True THEN
      curSkin = 3
      XPThemeEnabled = True
     ELSE
      curSkin = False
      curSkin = False
     END IF


     Label1.CAPTION = "DrawCount :  " +STR$(DrawCount)

     Form.SHOWMODAL

     SUB Enjolivure_Click

      SELECT CASE Sender.CAPTION
      CASE Button9.CAPTION
       QTBtnBMP.BMPHandle = btn_BMP
       curSkin = False
      CASE Button10.CAPTION
       QTBtnBMP.BMPHandle = btn_BMP1
       curSkin = True
      CASE Button11.CAPTION
       curSkin = 2
      CASE ELSE
       Button1.XPThemeEnabled = True
       Button2.XPThemeEnabled = True
       Button3.XPThemeEnabled = True
       Button5.XPThemeEnabled = True
       Button6.XPThemeEnabled = True
       Button7.XPThemeEnabled = True
       Button8.XPThemeEnabled = True
       Button9.XPThemeEnabled = True
       Button10.XPThemeEnabled = True
       Button11.XPThemeEnabled = True
       Button13.XPThemeEnabled = True
       Button15.XPThemeEnabled = True
       Button17.XPThemeEnabled = True
       Button19.XPThemeEnabled = True
       Button21.XPThemeEnabled = True
       Button22.XPThemeEnabled = True
       Button23.XPThemeEnabled = True
       XPThemeEnabled = True
       curSkin = 3
            'Image.BMP = Button8.BMP
      END SELECT

      IF curSkin = 2 THEN
       Button1.XPThemeEnabled = True
       Button2.XPThemeEnabled = True
       Button3.XPThemeEnabled = True
       QTBtnBMP.BMPHandle = btn_BMP
       Button5.XPThemeEnabled = False
       Button6.XPThemeEnabled = False
       Button7.XPThemeEnabled = False
       Button5.ReDraw
       Button6.ReDraw
       Button7.ReDraw
       QTBtnBMP.BMPHandle = btn_BMP1
       Button13.XPThemeEnabled = False
       Button15.XPThemeEnabled = False
       Button17.XPThemeEnabled = False
       Button19.XPThemeEnabled = False
       Button13.ReDraw
       Button15.ReDraw
       Button17.ReDraw
       Button19.ReDraw

      ELSEIF curSkin < 2 AND XPThemeEnabled = True THEN
       Button1.XPThemeEnabled = False
       Button2.XPThemeEnabled = False
       Button3.XPThemeEnabled = False
       Button5.XPThemeEnabled = False
       Button6.XPThemeEnabled = False
       Button7.XPThemeEnabled = False
       Button8.XPThemeEnabled = False
       Button9.XPThemeEnabled = False
       Button10.XPThemeEnabled = False
       Button11.XPThemeEnabled = False
       Button13.XPThemeEnabled = False
       Button15.XPThemeEnabled = False
       Button17.XPThemeEnabled = False
       Button19.XPThemeEnabled = False
       Button21.XPThemeEnabled = False
       Button22.XPThemeEnabled = False
       Button23.XPThemeEnabled = False
       XPThemeEnabled = False
      ELSEIF curSkin < 2 AND XPThemeEnabled = False THEN
       Button1.ReDraw
       Button2.ReDraw
       Button3.ReDraw
       Button5.ReDraw
       Button6.ReDraw
       Button7.ReDraw
       Button8.ReDraw
       Button9.ReDraw
       Button10.ReDraw
       Button11.ReDraw
       Button13.ReDraw
       Button15.ReDraw
       Button17.ReDraw
       Button19.ReDraw
       Button21.ReDraw
       Button22.ReDraw
       Button23.ReDraw
      END IF
    'If curSkin <> False Then _
       'Image.BMP = QTBtnBMP.BMP
      Label1.CAPTION = "DrawCount :  " +STR$(DrawCount)
     END SUB

     SUB TabChange_Click
      IF Sender.CAPTION = Button2.CAPTION THEN
       Panel6.Visible = True
       Panel5.Visible = False
       Label2.PARENT = Panel6
       Image1.PARENT = Panel6
      ELSE
       Panel5.Visible = True
       Panel6.Visible = False
       Label2.PARENT = Panel5
       Image1.PARENT = Panel5
      END IF
     END SUB


     SUB TBoutons_MouseMove
      Image1.BMP = Sender.BMP
     END SUB

     SUB Bouton_MouseMove
      IF (X < 0) OR (Y < 0) OR (X > sender.Width) _
       OR (Y > Sender.Height) THEN
        ' le pseudo-evénement MOUSELEAVE
        ' the MOUSELEAVE pseudo-event
       ReleaseCapture_QTBtn
        ' dans cet example, on retourne le caption à la normal
        ' in this example revert the caption to normal
       Sender.Font.Bold = 0
       Sender.Font.COLOR = -2147483630

      ELSEIF GetCapture_QTBtn() <> Sender.Handle THEN
        ' le pseudo-evénement MOUSEENTER
        ' the MOUSEENTER pseudo-event
       SetCapture_QTBtn Sender.Handle
        ' dans cet example, on met le caption en gras
        ' in this example, make the caption bold
       Sender.Font.Bold = 1
       Sender.Font.COLOR = -2147483635
       Image1.BMP = Sender.BMP
      END IF
     END SUB
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2023-2-2  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:50:39