Page loading

Share your opinion
What do you think about gambaslinux.fr?
 
Interesting
It miss some informations
Excellent website
Results
WIDGETS GAMBAS
GAMBAS 3 SOFTWARES
TUTORIALS
Library
Printer and Gambas - Print a picture
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.





Creation date : 19/10/2009 @ 16:29
Last update : 19/10/2009 @ 16:29
Category : Printer and Gambas
Page read 6300 times


Print the article Print the article


react.gifReactions to this article

Nobody gave a comment yet.
Be the first one to do it!


QUICK MENU
SEARCH




LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS

   visitors

   visitors online

ARCHIVES GAMBAS 1/2
^ Top ^