Code: Alles auswählen
Declare IGadget(pbnr,sp,ze,br,hh,txt$,size,farbe)
Declare Api_DrawTextOutline2(dc,x,y,*text,lg,font,farbe)
Declare PrintOutline()
Enumeration
#button1
EndEnumeration
If OpenWindow(0,0,0,820,600,"Test") And CreateGadgetList(WindowID(0))
IGadget(#button1,100,10,160,60,"Drucken",22,#Green)
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget Or Event = #PB_Event_Menu
buttonevent = EventGadget()
Select buttonevent
Case #button1
PrintOutline()
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
End
Procedure PrintOutline()
;nur zur Demo PB Druckbefehle + Api gemischt
Protected font0=LoadFont(0, "Arial", 100)
DefaultPrinter()
StartPrinting("")
dc=StartDrawing(PrinterOutput())
txt$="Test"
Api_DrawTextOutline2(dc,20,20,@txt$,Len(txt$),font0,#White)
StopDrawing()
StopPrinting()
EndProcedure
Procedure IGadget(pbnr,sp,ze,br,hh,txt$,fontsize,farbe)
Protected boxfarbe=$F1F1F1 ;find ich persönlich besser
;boxfarbe=farbe
Protected font0=LoadFont(0, "Arial", fontsize)
xxx=CreateImage(pbnr, br, hh)
hdc=StartDrawing(ImageOutput(pbnr))
Box(0,0,br,hh,boxfarbe)
Api_DrawTextOutline2(hdc,20,20,@txt$,Len(txt$),font0,farbe)
StopDrawing ()
;Image zuweisn
ButtonImageGadget(pbnr,sp,ze,br,hh,ImageID(pbnr))
FreeFont(0) ;sollte man aufrufen
EndProcedure
Procedure Api_DrawTextOutline2(dc,x,y,*text,lg,font,farbe)
Protected oldspacing = GetTextCharacterExtra_(dc)
SelectObject_(dc, font)
SetTextCharacterExtra_(dc,2)
SetBkMode_(dc,#TRANSPARENT)
SetTextAlign_(dc,#TA_NOUPDATECP)
BeginPath_(dc)
TextOut_(dc,x,y,*text,lg)
EndPath_(dc)
;irgendeinen Brush
Protected brush=CreateSolidBrush_(farbe)
SelectObject_(dc,brush)
StrokeAndFillPath_(dc)
DeleteObject_(brush)
SetTextCharacterExtra_(dc,oldspacing)
EndProcedure