Wenn das auch nicht hinhauen sollte, könnte vielleicht die 'Print_SetDebug(#True)' Funktion helfen.
Sie erzeugt ein logfile im akuellen Verzeichnis das aufschluss über die ausführung einzelner Windows-API Befehle gibt.
Code: Alles auswählen
Global Max.l
Global idx.l
Global Zoom.l
Procedure Showimage()
SetGadgetText(6,Str(idx+1)+"/"+Str(max))
SetGadgetText(8,"Zoom "+Str(Zoom)+"%")
img=Print_GetPreviewImage(idx)
If img
SetGadgetState(1,ImageID(img))
EndIf
EndProcedure
Procedure Print_Preview(Preview)
Print_OpenPrinter("","PAPERSIZE="+Str(#DMPAPER_A4)+",ORIENTATION="+Str(#DMORIENT_PORTRAIT))
If Preview=#True
pw=(450*Zoom)/100
Print_StartPreview(pw)
xa=Print_GetDeviceCaps(#HORZRES)+20
ya=Print_GetDeviceCaps(#VERTRES)+20
SetGadgetAttribute(0,#PB_ScrollArea_InnerWidth,xa)
SetGadgetAttribute(0,#PB_ScrollArea_InnerHeight,ya)
Else
Print_StartPrinting("TEST")
EndIf
; Start preview
Print_SetTextColor(#Red)
Print_Font("Arial",48)
Text$="Print Lib Test Page"
textw=Print_TextWidth(text$)
texta=Print_GetTextMetrics(#TM_ASCENT)
textd=Print_GetTextMetrics(#TM_DESCENT)
texth=Print_GetTextMetrics(#TM_HEIGHT)
Print_SetLineColor(#Black)
Print_Line(20,20,textw,0)
Print_SetLineColor(#Yellow)
Print_Line(20,20+texta,textw,0)
Print_SetLineColor(#Blue)
Print_Line(20,20+texth,textw,0)
Print_Text(20,20,Text$)
Print_SetLineWidth(1)
Print_SetLineColor(#Green)
Print_CreateBrush(#Blue)
Print_Rectangle(19,19,textw+2,texth+2,#False)
Print_Font("Arial",12)
Print_Text(20,50,"Filled Rectangle")
Print_Rectangle(20,55,40,40,#True)
Print_Text(20+60,50,"Rectangle")
Print_Rectangle(20+60,55,40,40,#False)
Print_Text(20,100,"Filled Circle")
Print_Circle(40,125,20,#True)
Print_Text(20+60,100,"Circle")
Print_Circle(40+60,125,20,#False)
Print_Text(20,155,"Filled Ellipse")
Print_Ellipse(20,160,20+40,160+80,#True)
Print_Text(20+60,155,"Ellipse")
Print_Ellipse(20+60,160,20+40+60,160+80,#False)
; Preview end
If Preview=#True
Print_StopPreview()
Else
Print_StopPrinting()
EndIf
max=Print_GetPreviewCount()
Showimage()
EndProcedure
Procedure Button_First()
idx=0
Showimage()
EndProcedure
Procedure Button_Left()
If idx>0
idx-1
EndIf
Showimage()
EndProcedure
Procedure Button_Right()
If idx<(max-1)
idx+1
EndIf
Showimage()
EndProcedure
Procedure Button_Last()
If max>0
idx=max-1
Else
idx=max
EndIf
Showimage()
EndProcedure
Procedure Button_Zoom()
Select Zoom
Case 100
Zoom=150
Case 150
Zoom=200
Case 200
Zoom=300
Case 300
Zoom=400
Case 400
Zoom=500
Case 500
Zoom=800
Case 800
Zoom=100
EndSelect
Print_Preview(#True)
Showimage()
EndProcedure
If OpenWindow(0,0,0,500,720,"Test",#PB_Window_SystemMenu)
If CreateGadgetList(WindowID(0))
ScrollAreaGadget(0,10,10,480,680, 470, 670, 30)
ImageGadget(1,10,10,480,680,0)
CloseGadgetList()
EndIf
ButtonGadget(2,10,695,20,20,"|<")
ButtonGadget(3,30,695,20,20,"<")
ButtonGadget(4,50,695,20,20,">")
ButtonGadget(5,70,695,20,20,">|")
TextGadget(6,100,695,40,20,"0/0",#PB_Text_Border)
ButtonGadget(7,150,695,40,20,"Print")
ButtonGadget(8,200,695,70,20,"Zoom 100%")
EndIf
idx=0
Zoom=100
Print_Preview(#True)
Showimage()
Repeat
event=WaitWindowEvent()
Select event
Case #PB_Event_Gadget
If EventType()=#PB_EventType_LeftClick
Select EventGadget()
Case 2
Button_First()
Case 3
Button_Left()
Case 4
Button_Right()
Case 5
Button_Last()
Case 7
Print_Preview(#False)
Case 8
Button_Zoom()
EndSelect
EndIf
EndSelect
Until event=#PB_Event_CloseWindow
; IDE Options = PureBasic 4.10 (Windows - x86)
; CursorPosition = 11
; Folding = --