;Autor: netmaestro EnableExplicit Define EventID Global PrintWindow_ OpenLibrary(0, "user32.dll") Prototype PrintWindow(hwnd, hdc, flags) PrintWindow_.PrintWindow = GetFunction(0, "PrintWindow") Procedure CaptureGadget(Gadgetnummer,Imagenummer) Protected listrect.RECT Protected width Protected height Protected hdc GetWindowRect_(GadgetID(Gadgetnummer), @listrect.RECT) width = listrect\right-listrect\left height = listrect\bottom-listrect\top CreateImage(0, width, height, 24) hdc = StartDrawing(ImageOutput(0)) PrintWindow_(GadgetID(Gadgetnummer), hdc, #Null) StopDrawing() EndProcedure If OpenWindow(0,0,0,500,400,"Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) ListIconGadget(1,10,10,WindowWidth(0)-20,100,"Spalte 1",240,0) AddGadgetColumn(1,1,"Spalte 2",220) AddGadgetItem(1,-1,"Item 1"+Chr(10)+"Item 1",0,0) AddGadgetItem(1,-1,"Item 2"+Chr(10)+"Item 2",0,0) AddGadgetItem(1,-1,"Item 3"+Chr(10)+"Item 3",0,0) ImageGadget(2,10,120,0,0,0,0) CaptureGadget(1,2) SetGadgetState(2,ImageID(0)) Repeat EventID=WaitWindowEvent() If EventID = #PB_Event_CloseWindow End EndIf ForEver EndIf