Warum kommt bitte bei :
CanvasGadget(#canvas_1, 10, 10, 300, 300)
StartDrawing(CanvasOutput(#canvas_1)) kein Bild?
Hier kommt das Bild :
CanvasGadget(0, 10, 10, 300, 300)
StartDrawing(CanvasOutput(0))
......
Danke.
Gruss
Code: Alles auswählen
Global hdc.l,*poly,greenpen,brush
Global i.l,erg.l
Declare api_polygon()
Enumeration
#window_1
#canvas_1
EndEnumeration
*poly=AllocateMemory(32)
If OpenWindow(#window_1 , 0, 0, 400,400, "Polygon", #PB_Window_SystemMenu)
CanvasGadget(#canvas_1, 10, 10, 300, 300)
Restore poly_p
For i=0 To 7
Read.l erg
PokeL(*poly+i*4,erg)
Next
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget And EventGadget() = 0
If EventType() = #PB_EventType_LeftButtonDown
hdc = StartDrawing(CanvasOutput(#canvas_1))
api_polygon()
StopDrawing()
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
Procedure api_polygon()
brush=CreateSolidBrush_(RGB(255,0,0))
greenPen=CreatePen_(#PS_SOLID, 2, RGB(0,255,0))
SelectObject_(hdc,greenPen)
SelectObject_(hDC, brush)
MoveToEx_(hdc, 100, 100,0)
LineTo_(hdc,200,100)
Polygon_(hdc,*poly,4)
EndProcedure
DataSection
poly_p:
Data.l -50,-30,50,-30,50,30,-50,30
EndDataSection