;Autor: netmaestro ;http://www.purebasic.fr/english/viewtopic.php?p=196789#p196789 EnableExplicit Define EventID Global PrintWindow_ OpenLibrary(0, "user32.dll") Prototype PrintWindow(hwnd, hdc, flags) PrintWindow_.PrintWindow = GetFunction(0, "PrintWindow") Procedure CaptureGadget(GadgetNumber, ImageNumber) Protected listrect.RECT Protected width Protected height Protected hdc GetWindowRect_(GadgetID(GadgetNumber), @listrect.RECT) width = listrect\right-listrect\left height = listrect\bottom-listrect\top CreateImage(ImageNumber, width, height, 24) hdc = StartDrawing(ImageOutput(ImageNumber)) PrintWindow_(GadgetID(GadgetNumber), 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, "Column 1", 240, 0) AddGadgetColumn(1, 1, "Column 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(2)) Repeat EventID = WaitWindowEvent() If EventID = #PB_Event_CloseWindow End EndIf ForEver EndIf