Procedure DrawPoints(Windows)
If LoadFont(1, "Arial", 8)
If CreateImage(0, WindowWidth(Windows), WindowHeight(Windows)) And StartDrawing(ImageOutput(0))
DrawingMode(#PB_2DDrawing_Transparent)
Box(0, 0, WindowWidth(Windows), WindowHeight(Windows), RGB(245,245,245))
For i = 8 To (WindowWidth(Windows)) Step 10
DrawingFont(FontID(1))
DrawText( i,-2, ".", RGB(55, 55, 55))
For j = 8 To (WindowHeight(Windows)) Step 10
DrawingFont(FontID(1))
DrawText( i,j, ".", RGB(55, 55, 55))
Next
Next
StopDrawing()
ImageGadget(#PB_Any, 0, 0, 200, 200, ImageID(0))
EndIf
EndIf
EndProcedure
Procedure hDrawPoints(hWnd)
WindowSize.RECT
name.s = Space(100)
GetWindowRect_(hWnd, @WindowSize)
GetWindowText_(hWnd, @name, 100)
Width=WindowSize\Right - WindowSize\Left
Height=WindowSize\Bottom - WindowSize\Top
Left=WindowSize\Left
Top=WindowSize\Top
If LoadFont(1, "Arial", 8)
If CreateImage(0, Width, Height) And StartDrawing(ImageOutput(0))
DrawingMode(#PB_2DDrawing_Transparent)
Box(0, 0, Width, Height, RGB(245,245,245))
For i = 8 To Width Step 10
DrawingFont(FontID(1))
DrawText( i,-2, ".", RGB(55, 55, 55))
For j = 8 To Height Step 10
DrawingFont(FontID(1))
DrawText( i,j, ".", RGB(55, 55, 55))
Next
Next
StopDrawing()
ImageGadget(#PB_Any, 0, 0, 200, 200, ImageID(0))
EndIf
EndIf
EndProcedure
Procedure WinChildCallback(hWnd, Msg, wParam, lParam)
Select Msg
Case #WM_CLOSE
DestroyWindow_(hWnd)
Case #WM_DESTROY
PostQuitMessage_(0) : Result = 0
Case #WM_SIZE
;Debug hWnd
RedrawWindow_(hWnd, 0, 0, #RDW_UPDATENOW|#RDW_UPDATENOW) ; Уменьшаем мерцания окна с помошью Api при изменении его размеров.
hDrawPoints(hWnd)
Default
Result = DefWindowProc_(hWnd, Msg, wParam, lParam)
EndSelect
ProcedureReturn Result
EndProcedure
;- Изменяем размеры и Уменьшаем мерцание
Procedure WindowResize(WindowID, Message, wParam, lParam)
Result = #PB_ProcessPureBasicEvents
If Message = #WM_SIZE
; Debug 1
DrawPoints(hWnd)
EndIf
ProcedureReturn Result
EndProcedure
Procedure WinChild(Class.s, x, y, width, height,Caption$,Win)
wc.WNDCLASSEX
wc\cbsize = SizeOf(WNDCLASSEX)
wc\lpfnWndProc = @WinChildCallback()
wc\hCursor = LoadCursor_(0, #IDC_ARROW)
wc\hbrBackground = #COLOR_WINDOW
wc\lpszClassName = @Class
RegisterClassEx_(@wc)
ProcedureReturn CreateWindowEx_(0, Class, Caption$, #WS_VISIBLE|#WS_SYSMENU | #WS_MINIMIZEBOX|#WS_MAXIMIZEBOX|#WS_SIZEBOX | #WS_CLIPCHILDREN | #WS_CLIPSIBLINGS, x, y, width, height, Win,0, 0, 0)
EndProcedure
hWnd = OpenWindow(0, 0, 0, 800, 600, "Средствами PureBasic - "+Chr(34)+" Главное окно "+Chr(34),#PB_Window_Invisible | #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
;SetThemeAppProperties_(0)
OpenWindow(1, 0, 0, 280, 220, "Дочернее окно",#PB_Window_Invisible | #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget, WindowID(0))
SetWindowCallback(@WindowResize())
SetParent_(WindowID(1), WindowID(0))
hWnd1=WinChild("Win2", 0, 0, 280, 230, "Дочернее окно", hWnd)
HideWindow(0,0)
HideWindow(1,0)
Repeat
Event=WaitWindowEvent()
Until Event=#PB_Event_CloseWindow