Page en cours de chargement

Donnez votre avis..
Que pensez-vous de gambaslinux.fr?
 
Interessant
Il manque des rubriques
excellent site
Résultats
INTERFACE GAMBAS
LOGICIELS GAMBAS 3
TUTORIELS
=Bibliothèque
Impression avec Gambas - Imprimer une image
IMPRIMER UNE IMAGE AVEC GAMBAS LINUX


Imprimer une image


(par taoteblues)


Créer un bouton pour l'impression:


PUBLIC SUB Button_Click()


DIM img AS Image

Dim monimage As String


monimage = "chemin du fichier image que je veux imprimer"

img = Image.Load(monimage)


PrintImage(img)

CATCH

Message.Error("Classe: " & Str(Error.class) & "nCode: " & error.code &

", = " & error.text & "nà: " & error.where, "OK")


END


Ajouter la fonction PrintImage()


PRIVATE SUB PrintImage(fichierimg AS Image)


DIM imageToPrint AS Image

DIM imageWidth AS Integer

DIM imageHeight AS Integer

DIM scaleIsotropic AS Float


INC Application.Busy


imageWidth = (fichierimg.Width * Printer.Resolution) / Desktop.Resolution

imageHeight = (fichierimg.Height * Printer.Resolution) / Desktop.Resolution



IF imageWidth > Printer.Width OR imageHeight > Printer.Height THEN

scaleIsotropic = Min(Printer.Width / imageWidth, Printer.Height / imageHeight)

imageWidth *= scaleIsotropic

imageHeight *= scaleIsotropic


END IF



imageToPrint = fichierimg.Stretch(imageWidth, imageHeight, TRUE)




Draw.Begin(Printer)

Draw.Image(imageToPrint, (Printer.Width - imageWidth) / 2, (Printer.Height - imageHeight) / 2)

Draw.End

DEC Application.Busy


END


L'attente pour l'impression peut être longue (1 à 2 minutes) en fonction de votre matériel et de la taille de l'image.





Date de création : 19/10/2009 @ 16:29
Dernière modification : 19/10/2009 @ 16:29
Catégorie : Impression avec Gambas
Page lue 5976 fois


Imprimer l'article Imprimer l'article


react.gifRéactions à cet article

Personne n'a encore laissé de commentaire.
Soyez donc le premier !


ACCES RAPIDE
RECHERCHE




LES INSTRUCTIONS
Divers
INSTRUCTIONS
Où ça, qui ça?
VISITES

   visiteurs

   visiteurs en ligne

ARCHIVES GAMBAS 1/2
^ Haut ^