Code : Tout sélectionner
Declare imprime(img,w,h)
Declare prepareprint()
If OpenWindow(0, 0, 0, 700, 350, "ListIconGadgets", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
; left column
TextGadget (6, 10, 10, 330, 20, "ListIcon Standard", #PB_Text_Center)
ListIconGadget(0, 10, 25, 330, 70, "Column 1", 100)
TextGadget (7, 10, 105, 330, 20, "ListIcon with Checkbox", #PB_Text_Center)
ListIconGadget(1, 10, 120, 330, 70, "Column 1", 100, #PB_ListIcon_CheckBoxes) ; ListIcon with checkbox
TextGadget (8, 10, 200, 330, 20, "ListIcon with Multi-Selection", #PB_Text_Center)
ListIconGadget(2, 10, 215, 330, 70, "Column 1", 100, #PB_ListIcon_MultiSelect) ; ListIcon with multi-selection
; right column
TextGadget (9, 360, 10, 330, 20, "ListIcon with separator lines",#PB_Text_Center)
ListIconGadget(3, 360, 25, 330, 70, "Column 1", 100, #PB_ListIcon_GridLines)
TextGadget (10, 360, 105, 330, 20, "ListIcon with FullRowSelect and AlwaysShowSelection",#PB_Text_Center)
ListIconGadget(4, 360, 120, 330, 70, "Column 1", 100, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
TextGadget (11, 360, 200, 330, 20, "ListIcon Standard with large icons",#PB_Text_Center)
ListIconGadget(5, 360, 220, 330, 65, "", 200,#PB_ListIcon_GridLines)
For a = 0 To 4 ; add columns to each of the first 5 listicons
For b = 2 To 4 ; add 3 more columns to each listicon
AddGadgetColumn(a, b, "Column " + Str(b), 65)
Next
For b = 0 To 2 ; add 4 items to each line of the listicons
AddGadgetItem(a, b, "Item 1"+Chr(10)+"Item 2"+Chr(10)+"Item 3"+Chr(10)+"Item 4")
Next
Next
; Here we change the ListIcon display to large icons and show an image
If LoadImage(0, #PB_Compiler_Home+"Examples\Sources\Data\File.bmp") ; change path/filename to your own 32x32 pixel image
SetGadgetAttribute(5, #PB_ListIcon_DisplayMode, #PB_ListIcon_LargeIcon)
AddGadgetItem(5, 1, "Picture 1", ImageID(0))
AddGadgetItem(5, 2, "Picture 2", ImageID(0))
EndIf
ButtonGadget(50,10,300,100,20,"imprimer ?")
BindGadgetEvent(50,@prepareprint())
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Procedure prepareprint()
Protected img,h,w,hpage,wpage,hprint,wprint
w=WindowWidth(0)
h=WindowHeight(0)
StartDrawing(WindowOutput(0))
DrawingMode(#PB_2DDrawing_AlphaChannel)
img = GrabDrawingImage(#PB_Any,0,0,w,h)
StopDrawing()
StartDrawing(ImageOutput(img))
DrawingMode(#PB_2DDrawing_AlphaChannel)
Box(0,0,w,h,RGBA(0,0,0,255))
StopDrawing()
;Ici j'ouvre juste pour voir le résultat....
; OpenWindow(1,0,0,WindowWidth(0),WindowHeight(0),"result")
; ImageGadget(#PB_Any,0,0,WindowWidth(0),WindowHeight(0),ImageID(img))
;pour imprimer ça doit ressembler à ça (je te laisse le loins de modifier w et h par le DPI de l'imprimante tout ça...
If PrintRequester()
wpage = PrinterPageWidth()
hpage = PrinterPageHeight()
If hpage > wpage ;Impression en portrait
MessageRequester("protrait","")
If w*wpage>h*hpage
wprint = wpage
hprint = h*wpage/w
Else
hprint = hpage
wprint = w*hpage/h
EndIf
Else ;Impression en paysage
If w*wpage>h*hpage
wprint=wpage
hprint = h*wpage/w
Else
hprint = hpage
wprint = w*hpage/h
EndIf
EndIf
imprime(img,wprint,hprint)
EndIf
EndProcedure
Procedure imprime(img,w,h)
If StartPrinting("Print window")
If StartDrawing(PrinterOutput())
DrawImage(ImageID(img),0, 0 , w,h)
StopDrawing()
EndIf
StopPrinting()
EndIf
FreeImage(img)
EndProcedure
de luis sur le forum EN qui explique mon erreur, j'ai mis à jour le code, j'éspère que ça te conviendra Micoute.
ne permet as de dessiner directelent sur l'imprimante, il faut passer par une image, mais j'espère que cette solution évitera de déformer les écritures, tiens moi au courant !