Bonjour à tous,
Dans une fenêtre, j'ai placé un PanelGadget qui prends toute la place en usage normal (fenêtre non agrandie).
Je voudrais pouvoir centrer ce gadget dans la fenêtre, si cette fenêtre est agrandie, SANS MODIFIER SA TAILLE, simplement le centrer.
Mais comment faire ? ResizeGadget sais faire, mais il augmente la taille du Panel en le centrant.
Ca doit être simple, mais je ne trouve pas une solution fiable.
Merci d'avance,
Phil
Utiliser ResizeWindows pour placer centrer un panel sans modifier sa taille
- Philippe_GEORGES
- Messages : 138
- Inscription : mer. 28/janv./2009 13:28
Utiliser ResizeWindows pour placer centrer un panel sans modifier sa taille
Philippe GEORGES
"La simplicité est la sophistication suprême" (De Vinci)
assistance informatique, création de logiciels
georges.informatique@gmail.com
"La simplicité est la sophistication suprême" (De Vinci)
assistance informatique, création de logiciels
georges.informatique@gmail.com
Re: Utiliser ResizeWindows pour placer centrer un panel sans modifier sa taille
Pourrais tu nous partager un petit code ? 

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Intel Core i7 4770 64 bits - GTX 650 Ti
Version de PB : 6.12LTS- 64 bits
- Mindphazer
- Messages : 693
- Inscription : mer. 24/août/2005 10:42
Re: Utiliser ResizeWindows pour placer centrer un panel sans modifier sa taille
Hello Phil,
quelque chose comme ça ?
quelque chose comme ça ?
Code : Tout sélectionner
Enumeration
#MainWindow
#Panel
EndEnumeration
Procedure OpenMainWindow(x = 0, y = 0, width = 430, height = 300)
OpenWindow(#MainWindow, x, y, width, height, "", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
PanelGadget(#Panel, 10, 20, 410, 270)
AddGadgetItem(#Panel, -1, "Tab 1")
CloseGadgetList()
EndProcedure
Procedure ResizeGadgetsMainWindow()
PanelX = WindowWidth(#MainWindow) / 2 - GadgetWidth(#Panel) / 2
PanelY = WindowHeight(#MainWindow) / 2 - GadgetHeight(#Panel) / 2
ResizeGadget(#Panel, PanelX, PanelY, #PB_Ignore, #PB_Ignore)
EndProcedure
OpenMainWindow()
BindEvent(#PB_Event_SizeWindow, @ResizeGadgetsMainWindow())
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Bureau : Win10 64bits
Maison : Macbook Pro M3 16" SSD 512 Go / Ram 24 Go - iPad Pro 32 Go (pour madame) - iPhone 15 Pro Max 256 Go
Maison : Macbook Pro M3 16" SSD 512 Go / Ram 24 Go - iPad Pro 32 Go (pour madame) - iPhone 15 Pro Max 256 Go
- Philippe_GEORGES
- Messages : 138
- Inscription : mer. 28/janv./2009 13:28
Re: Utiliser ResizeWindows pour placer centrer un panel sans modifier sa taille
Ben oui, incroyable !! Un grand merci !
Voici le code qui me fallait, je me dis que je n'avais pas assez réfléchi !!
Merci du temps passé pour me répondre !
Phil
Voici le code qui me fallait, je me dis que je n'avais pas assez réfléchi !!
Merci du temps passé pour me répondre !
Code : Tout sélectionner
Enumeration
#MainWindow
#Panel
EndEnumeration
Declare ResizeGadgetsMainWindow()
Procedure OpenMainWindow(x = 0, y = 0, width = 430, height = 300)
OpenWindow(#MainWindow, x, y, width, height, "", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered | #PB_Window_MaximizeGadget)
PanelGadget(#Panel, 10, 20, 410, 270)
AddGadgetItem(#Panel, -1, "Tab 1")
CloseGadgetList()
BindEvent(#PB_Event_SizeWindow, @ResizeGadgetsMainWindow())
EndProcedure
Procedure ResizeGadgetsMainWindow()
PanelX = WindowWidth(#MainWindow) / 2 - GadgetWidth(#Panel) / 2
PanelY = WindowHeight(#MainWindow) / 2 - GadgetHeight(#Panel) / 2
ResizeGadget(#Panel, PanelX, PanelY, #PB_Ignore, #PB_Ignore)
EndProcedure
OpenMainWindow()
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Philippe GEORGES
"La simplicité est la sophistication suprême" (De Vinci)
assistance informatique, création de logiciels
georges.informatique@gmail.com
"La simplicité est la sophistication suprême" (De Vinci)
assistance informatique, création de logiciels
georges.informatique@gmail.com