FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC

Développement d'applications avec le langage Panoramic
 
AccueilAccueil  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  MembresMembres  Connexion  
Derniers sujets
» bouton dans autre form que 0
Création de boutons avec images et textes dessinés Emptypar leclode Aujourd'hui à 13:59

» KGF_dll - nouvelles versions
Création de boutons avec images et textes dessinés Emptypar Klaus Aujourd'hui à 11:41

» Gestion d'un système client-serveur.
Création de boutons avec images et textes dessinés Emptypar Klaus Aujourd'hui à 10:23

» PANORAMIC V 1
Création de boutons avec images et textes dessinés Emptypar papydall Sam 4 Mai 2024 - 3:43

» Editeur EliP 6 : Le Tiny éditeur avec 25 onglets de travail
Création de boutons avec images et textes dessinés Emptypar Froggy One Jeu 2 Mai 2024 - 11:16

» @Jack
Création de boutons avec images et textes dessinés Emptypar Jack Mar 30 Avr 2024 - 20:40

» trop de fichiers en cours
Création de boutons avec images et textes dessinés Emptypar papydall Lun 29 Avr 2024 - 23:39

» Une calculatrice en une ligne de programme
Création de boutons avec images et textes dessinés Emptypar jean_debord Dim 28 Avr 2024 - 8:47

» Form(résolu)
Création de boutons avec images et textes dessinés Emptypar leclode Sam 27 Avr 2024 - 17:59

» Bataille navale SM
Création de boutons avec images et textes dessinés Emptypar jjn4 Ven 26 Avr 2024 - 17:39

» Les maths du crocodile
Création de boutons avec images et textes dessinés Emptypar jean_debord Jeu 25 Avr 2024 - 10:37

» Naissance de Crocodile Basic
Création de boutons avec images et textes dessinés Emptypar jean_debord Jeu 25 Avr 2024 - 8:45

» Dessine-moi une galaxie
Création de boutons avec images et textes dessinés Emptypar jjn4 Lun 22 Avr 2024 - 13:47

» Erreur END_SUB
Création de boutons avec images et textes dessinés Emptypar jjn4 Lun 22 Avr 2024 - 13:43

» Bug sur DIM_LOCAL ?
Création de boutons avec images et textes dessinés Emptypar papydall Dim 21 Avr 2024 - 23:30

Navigation
 Portail
 Index
 Membres
 Profil
 FAQ
 Rechercher
Rechercher
 
 

Résultats par :
 
Rechercher Recherche avancée
Mai 2024
LunMarMerJeuVenSamDim
  12345
6789101112
13141516171819
20212223242526
2728293031  
CalendrierCalendrier
Le Deal du moment : -20%
-20% Récupérateur à eau mural 300 ...
Voir le deal
79 €

 

 Création de boutons avec images et textes dessinés

Aller en bas 
3 participants
AuteurMessage
Klaus

Klaus


Nombre de messages : 12289
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Création de boutons avec images et textes dessinés Empty
MessageSujet: Création de boutons avec images et textes dessinés   Création de boutons avec images et textes dessinés EmptyVen 31 Aoû 2012 - 19:56

J'ai utilisé mes nouvelles routines de KGF.dll (celles qui savent dessiner un texte sous n'importe quel angle dans un picture) pour créer des boutons simulés par des picture. La taille peut être choisie librement.

On peut placer une image selon 3 modes:
- collée en haut à gauche dans le bouton
- centrée dans le bouton
- étirée pour couvrir tout le bouton

Pour les deux premier modes, il faut bien sûr que l'image tienne dans le bouton. Pour la troisième, elle se réduit ou s'agrandit automatiquement - on peut même prendre une grande photo qui deviendra une miniature sur le bouton.

On peut ajouter un texte, en gérant tous les attributs du texte (police, taille, gras, italique, souligné et barré), la couleur du texte, l'emplacement, l'angle d'orientation, la courbe que suivra le texte.

Le programme génère 3 images:
- bouton normal sans focus
- bouton normal (sortie) avec focus
- bouton cliqué (enfoncé) avec focus

Bon, d'accord: visuellement, c'est le mode XP. Libre aux amateurs de l'adapter.

On peut sauvegarder ces trois images. Le programme demande alors un dossier, puis le nom du bouton. Il va ensuite enregistrer ces 3 images dans le dossier indiqué, utilisant le nom du projet avec des compléments clairs pour indiquer le type de l'image.

Puis, il y a un bouton "Tester". Cela permet, une fois que le bouton est enregistré, de générer un bouton de ce type dans la form et de l'utiliser, afin de juger de l'effet produit.

Voici le source:
Code:
' construction_bouton.bas

' utilise les fonctions suivantes de KGF.dll:
'    ResizePicture  ConfigureCurveWToP  WriteTextOverPicture  FolderSelect


label labels : gosub labels

gosub constantes
gosub variables
gosub donnees
gosub menu
gosub form0
gosub GUI
gosub initialisations

end

labels:
  label constantes, variables, donnees, menu, form0, GUI, initialisations
  label generer, dessiner, sel_image, dessiner_image, dessiner_texte
  label sauver, tester, click_test
  return

constantes:
  dim dll$ : dll$ = "KGF.dll"
  dim M1% : M1% = 0 - 1
  return
 
variables:
  dim no%, no1%, no2%, i%, j%, k%, n%, s$, s1$, s2$, w%, h%
  dim r%, g%, b%, f$, iw%, ih%, ix%, iy%, res%, t$, xt%, yt%, st%
  dim no_img0%, no_img1%, no_img2%, no_larg%, no_haut%, no_bouton%
  dim no_images%(3,9), no_pic%, no_bouton_pic%, no_image%, no_temp%
  dim no_open%, no_image_mode%, no_texte%, no_font%, no_font_size%, no_tester%
  dim no_font_b%, no_font_i%, no_font_u%, no_font_s%, no_font_rotate%
  dim no_font_angle%, no_font_curve%, no_font_curve_x%, no_font_curve_y%
  dim no_font_curve_delta%, no_font_curve_coeff%, no_font_x%, no_font_y%
  dim no_font_r%, no_font_g%, no_font_bl%, no_bouton_test%
  dim xcentre%, ycentre%, delta%, facteur%, hnd%, coul%, pos%, font$
  dim attrib%, angle%, racine$, dossier$, projet$
donnees:
' *** bouton_non_focus
' vignette 1
  data 228,225,210, 243,240,225, 233,230,215, 237,233,221
  data 238,235,220, 255,255,241, 255,252,237, 255,255,243
  data 235,232,217, 255,255,240, 246,243,228, 244,240,228
  data 234,231,216, 255,254,239, 241,238,223, 235,231,219
' vignette 2
  data 235,231,219, 255,255,244, 243,239,228, 236,232,221
  data 235,232,217, 255,255,243, 243,239,228, 236,232,221
  data 235,231,219, 255,255,244, 243,239,228, 236,232,221
  data 235,232,217, 255,255,243, 243,239,228, 236,232,221
' vignette 3
  data 241,237,225, 255,255,244, 235,231,220, 237,233,222
  data 244,241,226, 247,243,231, 183,179,167, 168,164,152
  data 237,234,217, 115,112,97, 114,111,96, 115,112,97
  data 246,243,226, 224,221,204, 241,238,221, 236,233,216
' vignette 4
  data 235,233,221, 235,233,221, 235,233,221, 235,233,221
  data 255,255,244, 255,255,244, 255,255,244, 255,255,244
  data 241,239,227, 241,239,227, 241,239,227, 241,239,227
  data 235,233,220, 235,233,220, 235,233,220, 235,233,220
' vignette 5
  data 255,255,255, 255,255,255, 255,255,255, 255,255,255
  data 255,255,255, 255,255,255, 255,255,255, 255,255,255
  data 255,255,255, 255,255,255, 255,255,255, 255,255,255
  data 255,255,255, 255,255,255, 255,255,255, 255,255,255
' vignette 6
  data 236,233,216, 236,233,216, 236,233,216, 236,233,216
  data 172,169,152, 172,169,152, 172,169,152, 172,169,152
  data 114,111,94, 114,111,94, 114,111,94, 114,111,94
  data 237,234,217, 237,234,217, 237,234,217, 237,234,217
' vignette 7
  data 235,232,217, 241,238,223, 230,227,212, 239,236,221
  data 255,254,239, 255,255,241, 110,107,92, 236,233,218
  data 244,241,226, 170,167,152, 117,114,99, 240,237,222
  data 234,231,216, 172,169,154, 115,112,97, 236,233,218
' vignette 8
  data 235,232,215, 172,169,152, 114,111,94, 237,234,217
  data 235,232,215, 172,169,152, 114,111,94, 237,234,217
  data 235,232,215, 172,169,152, 114,111,94, 237,234,217
  data 235,232,215, 172,169,152, 114,111,94, 237,234,217
' vignette 9
  data 227,224,207, 179,176,159, 115,112,95, 230,227,210
  data 175,172,155, 165,162,145, 118,115,98, 235,232,215
  data 115,112,95, 114,111,94, 115,112,95, 237,234,217
  data 236,233,216, 241,238,221, 224,221,204, 246,243,226
' *** bouton_focus_out
' vignette 1
  data 236,234,222, 241,239,227, 233,233,223, 233,233,223
  data 233,231,219, 1,1,0, 1,1,0, 1,1,0
  data 238,238,226, 1,1,0, 255,255,246, 255,255,248
  data 228,228,216, 5,5,0, 255,255,246, 240,240,230
' vignette 2
  data 235,233,220, 3,0,0, 255,254,255, 241,238,229
  data 235,233,220, 3,0,0, 255,254,255, 241,238,229
  data 235,233,220, 3,0,0, 255,254,255, 241,238,229
  data 235,233,220, 3,0,0, 255,254,255, 241,238,229
' vignette 3
  data 238,236,223, 3,1,0, 255,255,243, 173,171,159
  data 233,231,218, 8,6,0, 110,108,96, 113,111,99
  data 236,234,221, 3,1,0, 6,4,0, 3,1,0
  data 235,233,218, 232,230,217, 234,232,219, 235,233,220
' vignette 4
  data 235,233,221, 235,233,221, 235,233,221, 235,233,221
  data 3,0,0, 3,0,0, 3,0,0, 3,0,0
  data 255,255,246, 255,255,246, 255,255,246, 255,255,246
  data 242,240,228, 242,240,228, 242,240,228, 242,240,228
' vignette 5
  data 255,255,255, 255,255,255, 255,255,255, 255,255,255
  data 255,255,255, 255,255,255, 255,255,255, 255,255,255
  data 255,255,255, 255,255,255, 255,255,255, 255,255,255
  data 255,255,255, 255,255,255, 255,255,255, 255,255,255
' vignette 6
  data 171,169,156, 171,169,156, 171,169,156, 171,169,156
  data 113,111,98, 113,111,98, 113,111,98, 113,111,98
  data 3,1,0, 3,1,0, 3,1,0, 3,1,0
  data 235,233,220, 235,233,220, 235,233,220, 235,233,220
' vignette 7
  data 241,239,227, 233,231,219, 232,230,217, 238,236,223
  data 3,0,0, 3,1,0, 3,1,0, 238,236,224
  data 255,255,246, 121,118,109, 3,0,0, 235,232,223
  data 166,163,154, 113,110,101, 9,6,0, 234,231,222
' vignette 8
  data 169,167,152, 114,112,99, 4,2,0, 235,233,221
  data 169,167,152, 114,112,99, 4,2,0, 235,233,221
  data 169,167,152, 114,112,99, 4,2,0, 235,233,221
  data 169,167,152, 114,112,99, 4,2,0, 235,233,221
' vignette 9
  data 172,168,156, 116,112,100, 4,0,0, 238,234,222
  data 114,110,98, 108,104,92, 4,0,0, 235,231,219
  data 4,0,0, 11,7,0, 4,0,0, 237,233,221
  data 236,232,220, 236,232,220, 240,236,224, 235,231,219
' *** bouton_focus_out
' vignette 1
  data 230,227,212, 241,237,225, 236,232,220, 236,232,220
  data 238,235,220, 4,0,0, 4,0,0, 6,2,0
  data 235,231,219, 8,4,0, 166,162,150, 176,172,161
  data 230,226,214, 4,0,0, 180,176,164, 227,223,212
' vignette 2
  data 237,233,221, 4,0,0, 172,168,157, 235,231,220
  data 237,234,219, 4,0,0, 172,168,157, 235,231,220
  data 237,233,221, 4,0,0, 172,168,157, 235,231,220
  data 237,234,219, 4,0,0, 172,168,157, 235,231,220
' vignette 3
  data 239,235,223, 4,0,0, 180,176,165, 230,226,217
  data 237,234,219, 4,0,0, 174,170,159, 177,173,164
  data 235,231,219, 13,9,0, 4,0,0, 4,0,0
  data 231,228,213, 237,233,221, 234,230,218, 237,233,222
' vignette 4
  data 236,232,220, 236,232,220, 236,232,220, 236,232,220
  data 4,0,0, 4,0,0, 4,0,0, 4,0,0
  data 172,168,156, 172,168,156, 172,168,156, 172,168,156
  data 236,232,220, 236,232,220, 236,232,220, 236,232,220
' vignette 5
  data 255,255,255, 255,255,255, 255,255,255, 255,255,255
  data 255,255,255, 255,255,255, 255,255,255, 255,255,255
  data 255,255,255, 255,255,255, 255,255,255, 255,255,255
  data 255,255,255, 255,255,255, 255,255,255, 255,255,255
' vignette 6
  data 235,231,219, 235,231,219, 235,231,219, 235,231,219
  data 172,168,156, 172,168,156, 172,168,156, 172,168,156
  data 4,0,0, 4,0,0, 4,0,0, 4,0,0
  data 236,232,221, 236,232,221, 236,232,221, 236,232,221
' vignette 7
  data 236,232,220, 236,232,220, 241,237,225, 230,227,212
  data 6,2,0, 4,0,0, 4,0,0, 238,235,220
  data 176,172,161, 166,162,150, 8,4,0, 235,231,219
  data 227,223,212, 180,176,164, 4,0,0, 230,226,214
' vignette 8
  data 235,231,220, 172,168,157, 4,0,0, 237,233,221
  data 235,231,220, 172,168,157, 4,0,0, 237,234,219
  data 235,231,220, 172,168,157, 4,0,0, 237,233,221
  data 235,231,220, 172,168,157, 4,0,0, 237,234,219
' vignette 9
  data 230,226,217, 180,176,165, 4,0,0, 239,235,223
  data 177,173,164, 174,170,159, 4,0,0, 237,234,219
  data 4,0,0, 4,0,0, 13,9,0, 235,231,219
  data 237,233,222, 234,230,218, 237,233,221, 231,228,213

  data "fini"
 
  return

menu:
  return

form0:
  full_space 0 : caption 0,"Construction d'un bouton dans un picture"
  return

GUI:
  for i%=1 to 3
    for j%=1 to 9
      no% = no% + 1 : image no%
      no_images%(i%,j%) = no%
    next j%
  next i%
  no% = no% + 1 : picture no% : hide no% : no_pic% = no%
    width no%,4 : height no%,4

  no% = no% + 1 : container no% : no1% = no% : caption no%,"Configuration"
    top no%,10 : left no%,5 : width no%,width(0) - 50 : height no%,150

    no% = no% + 1 : container no% : no2% = no% : parent no%,no1% : width no%,130
      caption no%,"Images à construire" : top no%,20 : left no%,10
      no% = no% + 1 : check no% : parent no%,no2% : no_img0% = no%
        caption no%,"Image sans focus" : top no%,20 : left no%,10 : width no%,110
      no% = no% + 1 : check no% : parent no%,no2% : no_img1% = no%
        caption no%,"Image avec focus" : top no%,50 : left no%,10 : width no%,110
      no% = no% + 1 : check no% : parent no%,no2% : no_img2% = no%
        caption no%,"Image enfoncé" : top no%,80 : left no%,10 : width no%,110
     
    no% = no% + 1 : container no% : no2% = no% : parent no%,no1% : width no%,130
      caption no%,"Dimensions" : top no%,20 : left no%,160
      no% = no% + 1 : alpha no% : parent no%,no2% : caption no%,"Largeur:"
        top no%,20 : left no%,10
      no% = no% + 1 : edit no% : parent no%,no2% : no_larg% = no%
        top no%,20 : left no%,70 : width no%,30
      no% = no% + 1 : alpha no% : parent no%,no2% : caption no%,"Hauteur:"
        top no%,50 : left no%,10
      no% = no% + 1 : edit no% : parent no%,no2% : no_haut% = no%
        top no%,50 : left no%,70 : width no%,30

    no% = no% + 1 : container no% : no2% = no% : parent no%,no1% : width no%,130
      caption no%,"Image" : top no%,20 : left no%,300 : width no%,230
      no% = no% + 1 : picture no% : parent no%,no2% : no_bouton_pic% = no%
        top no%,20 : left no%,10 : width no%,120 : height no%,80
        stretch_on no%
      no% = no% + 1 : button no% : parent no%,no2% : top no%,20 : left no%,140
        caption no%,"..." : width no%,30 : on_click no%,sel_image
      no% = no% + 1 : check no% : parent no%,no2% : no_image% = no%
        top no%,50 : left no%,140 : caption no%,"Inclure" : width no%,70
      no% = no% + 1 : combo no% : parent no%,no2% : no_image_mode% = no%
        top no%,70 : left no%,140 : width no%,70

    no% = no% + 1 : container no% : no2% = no% : parent no%,no1% : width no%,130
      caption no%,"Texte" : top no%,20 : left no%,540 : width no%,620
      no% = no% + 1 : edit no% : parent no%,no2% : no_texte% = no%
        top no%,20 : left no%,10 : width no%,540
      no% = no% + 1 : combo no% : parent no%,no2% : no_font% = no%
        top no%,50 : left no%,10 : width no%,200 : font_names_load no%
        text no_font%,"Times New Roman"
      no% = no% + 1 : combo no% : parent no%,no2% : no_font_size% = no%
        top no%,50 : left no%,220 : width no%,60
      no% = no% + 1 : check no% : parent no%,no2% : no_font_b% = no%
        top no%,50 : left no%,290 : width no%,30 : caption no%,"B"
      no% = no% + 1 : check no% : parent no%,no2% : no_font_i% = no%
        top no%,50 : left no%,330 : width no%,30 : caption no%,"I"
      no% = no% + 1 : check no% : parent no%,no2% : no_font_u% = no%
        top no%,50 : left no%,370 : width no%,30 : caption no%,"U"
      no% = no% + 1 : check no% : parent no%,no2% : no_font_s% = no%
        top no%,50 : left no%,410 : width no%,30 : caption no%,"S"
      no% = no% + 1 : alpha no% : parent no%,no2%
        top no%,50 : left no%,460 : caption no%,"à ("
      no% = no% + 1 : edit no% : parent no%,no2% : no_font_x% = no%
        top no%,50 : left no%,480 : width no%,30
      no% = no% + 1 : alpha no% : parent no%,no2%
        top no%,50 : left no%,510 : caption no%,","
      no% = no% + 1 : edit no% : parent no%,no2% : no_font_y% = no%
        top no%,50 : left no%,515 : width no%,30
      no% = no% + 1 : alpha no% : parent no%,no2%
        top no%,50 : left no%,545 : caption no%,")"
      no% = no% + 1 : check no% : parent no%,no2% : no_font_rotate% = no%
        top no%,80 : left no%,10 : width no%,70 : caption no%,"Incliné de"
      no% = no% + 1 : edit no% : parent no%,no2% : no_font_angle% = no%
        top no%,80 : left no%,80 : width no%,30
      no% = no% + 1 : alpha no% : parent no%,no2%
        top no%,80 : left no%,115 : caption no%,"°"
      no% = no% + 1 : check no% : parent no%,no2% : no_font_curve% = no%
        top no%,80 : left no%,140 : width no%,140
        caption no%,"Selon courbe de centre ("
      no% = no% + 1 : edit no% : parent no%,no2% : no_font_curve_x% = no%
        top no%,80 : left no%,280 : width no%,30
      no% = no% + 1 : alpha no% : parent no%,no2%
        top no%,80 : left no%,310 : caption no%,","
      no% = no% + 1 : edit no% : parent no%,no2% : no_font_curve_y% = no%
        top no%,80 : left no%,320 : width no%,30
      no% = no% + 1 : alpha no% : parent no%,no2%
        top no%,80 : left no%,355 : caption no%,")  pas"
      no% = no% + 1 : edit no% : parent no%,no2% : no_font_curve_delta% = no%
        top no%,80 : left no%,390 : width no%,30
      no% = no% + 1 : alpha no% : parent no%,no2%
        top no%,80 : left no%,425 : caption no%,"°  Coeff"
      no% = no% + 1 : edit no% : parent no%,no2% : no_font_curve_coeff% = no%
        top no%,80 : left no%,465 : width no%,30
      no% = no% + 1 : alpha no% : parent no%,no2%
        top no%,80 : left no%,500 : caption no%,"%"
       
      no% = no% + 1 : alpha no% : parent no%,no2%
        top no%,20 : left no%,565 : caption no%,"R:"
      no% = no% + 1 : edit no% : parent no%,no2% : no_font_r% = no%
        top no%,20 : left no%,580 : width no%,30
      no% = no% + 1 : alpha no% : parent no%,no2%
        top no%,50 : left no%,565 : caption no%,"G:"
      no% = no% + 1 : edit no% : parent no%,no2% : no_font_g% = no%
        top no%,50 : left no%,580 : width no%,30
      no% = no% + 1 : alpha no% : parent no%,no2%
        top no%,80 : left no%,565 : caption no%,"B:"
      no% = no% + 1 : edit no% : parent no%,no2% : no_font_bl% = no%
        top no%,80 : left no%,580 : width no%,30

    no% = no% + 1 : button no%  : on_click no%,generer
      top no%,180 : left no%,10 : caption no%,"Générer"
    no% = no% + 1 : button no%  : on_click no%,sauver
      top no%,180 : left no%,110 : caption no%,"Sauvegarder"
    no% = no% + 1 : button no%  : on_click no%,tester : no_tester% = no%
      top no%,180 : left no%,300 : caption no%,"Tester" : inactive no%

    no% = no% + 1 : image no% : no_temp% = no%
    no% = no% + 1 : open_dialog no% : no_open% = no%
   
    no% = no% + 1 : no_bouton_test% = no% : ' réservation du numéro
     
  return

initialisations:
  2d_target_is no_pic%
  for k%=1 to 3
    for n%=1 to 9
      for i%=0 to 3
        for j%=0 to 3
          read r% : read g% : read b%
          2d_pen_color r%,g%,b%
          2d_point i%,j%
        next j%
      next i%
      2d_image_copy no_images%(k%,n%),0,0,3,3
    next n%
  next k%
  read s$
  if s$<>"fini" then message "Erreur dans la structure des DATA"
  mark_on no_img0%
  mark_on no_img1%
  mark_on no_img2%
  text no_larg%,"300"
  text no_haut%,"200"
  item_add no_image_mode%,"Standard"
  item_add no_image_mode%,"Centré"
  item_add no_image_mode%,"Etiré"
  text no_image_mode%,"Standard"
  item_add no_font_size%,"6"
  item_add no_font_size%,"8"
  item_add no_font_size%,"9"
  item_add no_font_size%,"10"
  item_add no_font_size%,"11"
  item_add no_font_size%,"12"
  item_add no_font_size%,"14"
  item_add no_font_size%,"16"
  item_add no_font_size%,"18"
  item_add no_font_size%,"20"
  item_add no_font_size%,"22"
  item_add no_font_size%,"24"
  item_add no_font_size%,"28"
  item_add no_font_size%,"32"
  item_add no_font_size%,"36"
  item_add no_font_size%,"40"
  item_add no_font_size%,"48"
  text no_font_size%,"10"
  text no_font_r%,"0"
  text no_font_g%,"0"
  text no_font_bl%,"0"
  dll_on dll$
  return

generer:
  if object_exists(no_bouton_test%)=1 then delete no_bouton_test%
  inactive no_tester%
  s$ = text$(no_larg%)
  if numeric(s$)=0
    message "Largeur invalide"
    return
  end_if
  w% = val(s$)
  if w%<1
    message "Largeur invalide"
    return
  end_if
  s$ = text$(no_haut%)
  if numeric(s$)=0
    message "Hauteur invalide"
    return
  end_if
  h% = val(s$)
  if h%<1
    message "Hauteur invalide"
    return
  end_if
  if no_bouton%=0
    no% = no% + 1 : no_bouton% = no%
  end_if
  2d_target_is 0
  if object_exists(no_bouton%)=1 then delete no_bouton%
  if object_exists(no_bouton%+1)=1 then delete no_bouton%+1
  if object_exists(no_bouton%+2)=1 then delete no_bouton%+2
  if checked(no_img0%)=1
    picture no_bouton% : hide no_bouton% : top no_bouton%,230
      left no_bouton%,10
      width no_bouton%,w% : height no_bouton%,h%
      n% = 1
      gosub dessiner
      gosub dessiner_image
      gosub dessiner_texte
      show no_bouton%
  end_if
  if checked(no_img1%)=1
    picture no_bouton%+1 : hide no_bouton%+1 : top no_bouton%+1,230
      left no_bouton%+1,10+w%+10
      width no_bouton%+1,w% : height no_bouton%+1,h%
      n% = 2
      gosub dessiner
      gosub dessiner_image
      gosub dessiner_texte
      show no_bouton%+1
  end_if
  if checked(no_img2%)=1
    picture no_bouton%+2 : hide no_bouton%+2 : top no_bouton%+2,230
      left no_bouton%+2,10+2*(w%+10)
      width no_bouton%+2,w% : height no_bouton%+2,h%
      n% = 3
      gosub dessiner
      2d_pen_dash : 2d_rectangle 5,5,w%-5,h%-5 : 2d_pen_dot
      gosub dessiner_image
      gosub dessiner_texte
      show no_bouton%+2
  end_if

  return
 
dessiner:
  2d_target_is no_bouton%+n%-1
  ' ligne H
  for i%=1 to w%-4
    2d_image_paste no_images%(n%,2),i%,0
  next i%
  ' ligne B
  for i%=1 to w%-4
    2d_image_paste no_images%(n%,8),i%,h%-4
  next i%
  ' ligne G
  for i%=1 to h%-4
    2d_image_paste no_images%(n%,4),0,i%
  next i%
  ' ligne D
  for i%=1 to h%-4
    2d_image_paste no_images%(n%,6),w%-4,i%
  next i%
  ' coin HG
  2d_image_paste no_images%(n%,1),0,0
  ' coin HD
  2d_image_paste no_images%(n%,3),w%-4,0
  ' coin BG
  2d_image_paste no_images%(n%,7),0,h%-4
  ' coin BD
  2d_image_paste no_images%(n%,9),w%-4,h%-4
  ' centre
  2d_flood w%/2,h%/2,236,233,216
  display
  return
 
dessiner_image:
  if checked(no_image%)=1
    iw% = width(no_bouton_pic%)
    ih% = height(no_bouton_pic%)
    ix% = 6
    iy% = 6
    if text$(no_image_mode%)="Centré"
      ix% = (w%-iw%)/2
      iy% = (h%-ih%)/2
    end_if
    if text$(no_image_mode%)="Etiré"
      iw% = w% - 12
      ih% = h% - 12
    end_if
   
clipboard_copy no_bouton_pic%
res% = dll_call2("ResizePicture",ih%,iw%)
width no_pic%,iw% : height no_pic%,ih%
clipboard_paste no_pic%

    2d_target_is no_pic%
    2d_image_copy no_temp%,0,0,iw%-1,ih%-1
    2d_target_is no_bouton%+n%-1
    2d_image_paste no_temp%,ix%,iy%
    display
  end_if
  return

sel_image:
  f$ = file_name$(no_open%)
  if f$="_" then return
  file_load no_bouton_pic%,f$
  mark_on no_image%
  return

dessiner_texte:
    t$ = trim$(text$(no_texte%))
    if len(t$)=0 then return
    attrib% = 0
    if checked(no_font_curve%)=1
      attrib% = attrib% + 32768
      xcentre% = val(text$(no_font_curve_x%))
      ycentre% = val(text$(no_font_curve_y%))
      delta% = val(text$(no_font_curve_delta%))
      facteur% = val(text$(no_font_curve_coeff%))
      res% = dll_call4("ConfigureCurveWToP",xcentre%,ycentre%,delta%,facteur%)
    end_if
    hnd% = handle_canvas(no_bouton%+n%-1)
    xt% = val(text$(no_font_x%))
    yt% = val(text$(no_font_y%))
    st% = val(text$(no_font_size%))
    pos% = xt%+yt%*65536
    font$ = text$(no_font%)
    angle% = 0
    if checked(no_font_rotate%)=1 then angle% = val(text$(no_font_angle%))
    if checked(no_font_b%)=1 then attrib% = attrib% + 1
    if checked(no_font_i%)=1 then attrib% = attrib% + 2
    if checked(no_font_u%)=1 then attrib% = attrib% + 4
    if checked(no_font_s%)=1 then attrib% = attrib% + 8
    attrib% = attrib% + 65536*angle% + 16*st%
    r% = val(text$(no_font_r%))
    g% = val(text$(no_font_g%))
    b% = val(text$(no_font_bl%))
    coul% = (b%*256+g%)*256+r%
    res% = dll_call6("WriteTextOverPicture",hnd%,pos%,adr(t$),adr(font$),attrib%,coul%)
    return
 
sauver:
  racine$ = dir_current$
  dossier$ = string$(255," ")
  res% = DLL_call4("FolderSelect",adr(racine$),adr(dossier$),len(dossier$),1)
  if res%=0 then return
  dossier$ = trim$(dossier$) + "\"
  projet$ = message_input$("Saisissez le nom du bouton","Nom du bouton:","")
  projet$ = trim$(projet$)
  if len(projet$)=0 then return
  if checked(no_img0%)=1 then file_save no_bouton%,dossier$+projet$+"_normal.bmp"
  if checked(no_img1%)=1 then file_save no_bouton%+1,dossier$+projet$+"_select_out.bmp"
  if checked(no_img2%)=1 then file_save no_bouton%+2,dossier$+projet$+"_select_in.bmp"
  active no_tester%
  return
 
tester:
  if object_exists(no_bouton_test%)=1 then delete no_bouton_test%
  picture no_bouton_test% : top no_bouton_test%,240+h% : left no_bouton_test%,10+w%
    width no_bouton_test%,w% : height no_bouton_test%,h%
    on_click no_bouton_test%,click_test
    file_load no_bouton_test%,dossier$+projet$+"_normal.bmp"
  return
 
click_test:
    file_load no_bouton_test%,dossier$+projet$+"_select_in.bmp"
    message "Le bouton est cliqué - traitement en cours..."
    file_load no_bouton_test%,dossier$+projet$+"_select_out.bmp"
    message "Le traitement est fini et le bouton est relaché..."
    file_load no_bouton_test%,dossier$+projet$+"_normal.bmp"
  return
 

Je suis conscient que la version avec FreeBasic que Jack prépare, va rendre ce type de simulation obsolète car on aura certainement des boutons images. Mais c'est un exercice intéressant pour l'utilisation de certaines fonctions de KGF.dll, y compris d'ailleurs la fonction qui redimensionne une image dans le presse-papier, puisque je m'en sers pour produire l'image adaptée à la taille du bouton.
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
Yannick




Nombre de messages : 8610
Age : 53
Localisation : Bretagne
Date d'inscription : 15/02/2010

Création de boutons avec images et textes dessinés Empty
MessageSujet: re   Création de boutons avec images et textes dessinés EmptyVen 31 Aoû 2012 - 21:42

Création de boutons avec images et textes dessinés Captur35
Revenir en haut Aller en bas
Jicehel

Jicehel


Nombre de messages : 5947
Age : 51
Localisation : 77500
Date d'inscription : 18/04/2011

Création de boutons avec images et textes dessinés Empty
MessageSujet: Re: Création de boutons avec images et textes dessinés   Création de boutons avec images et textes dessinés EmptyVen 31 Aoû 2012 - 22:03

Ce sera peut être et surement obsolète un jour, mais en attendant, c'est classe Wink
Revenir en haut Aller en bas
Klaus

Klaus


Nombre de messages : 12289
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Création de boutons avec images et textes dessinés Empty
MessageSujet: Re: Création de boutons avec images et textes dessinés   Création de boutons avec images et textes dessinés EmptyVen 31 Aoû 2012 - 22:48

@YGeronimi:
la ligne 510 est:
Code:
    xt% = val(text$(no_font_x%))
Comme tu peux voir, elle est syntactiquement parlant correcte. Il est vrai que je n'ai pas fait de tests de validation sur les champs de saisie. Tu as peut-être saisie un un texte sans renseigner les coordonnées d'écriture dans le champ à droite des attributs, libelle à (... , ...) ? Mets des coordonnées plausible et réessaie.

Voilà ce que ça donne chez moi, après avoir enregistré et cliqué sur le bouton Tester:
Création de boutons avec images et textes dessinés Aa118

Tu vois les valeurs numériques saisies ? Il n'y a pas de valeurs saisies pour la courbure car la case "selon courbe" n'est pas cochée.
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
Yannick




Nombre de messages : 8610
Age : 53
Localisation : Bretagne
Date d'inscription : 15/02/2010

Création de boutons avec images et textes dessinés Empty
MessageSujet: re   Création de boutons avec images et textes dessinés EmptyVen 31 Aoû 2012 - 22:53

cela vient peut être de là.

j'avais mis le placement à "centré", je pensais pas en avoir besoin.
Revenir en haut Aller en bas
Klaus

Klaus


Nombre de messages : 12289
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Création de boutons avec images et textes dessinés Empty
MessageSujet: Re: Création de boutons avec images et textes dessinés   Création de boutons avec images et textes dessinés EmptyVen 31 Aoû 2012 - 22:57

Ah, cette information se rapporte à l'image à afficher - tu vous que ce combo est dans le container Image en nom Texte.
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
Yannick




Nombre de messages : 8610
Age : 53
Localisation : Bretagne
Date d'inscription : 15/02/2010

Création de boutons avec images et textes dessinés Empty
MessageSujet: re   Création de boutons avec images et textes dessinés EmptyVen 31 Aoû 2012 - 23:00

J'ai voulu aller plus vite que la musique... Laughing

bon je referai un test plus tard, Embarassed désolé...
Revenir en haut Aller en bas
Contenu sponsorisé





Création de boutons avec images et textes dessinés Empty
MessageSujet: Re: Création de boutons avec images et textes dessinés   Création de boutons avec images et textes dessinés Empty

Revenir en haut Aller en bas
 
Création de boutons avec images et textes dessinés
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Affichage d'un GRID en HTML avec couleurs et images
» Les images avec l'exécutable
» concevoir un programme avec des images.
» Création d'une application avec Panoramic_Editor
» Cadre pour vos textes

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC :: PANORAMIC :: Vos sources, vos utilitaires à partager-
Sauter vers: