Accueil > > > CODE POUR REDIMENSIONNER TOUS VOS CONTROLES PROPORTIONNELLEMENT AU REDIMENSIONNEMENT DE LA FENETRE
CODE POUR REDIMENSIONNER TOUS VOS CONTROLES PROPORTIONNELLEMENT AU REDIMENSIONNEMENT DE LA FENETRE
Information sur la source
Description
En incluant ce code dans votre projet, ceci garantie qu'à chaque fois que l'utilisateur va redimensionner la fenêtre, tous vos contrôles seront toujours placé à la même place proportionnellement à celle où ils étaient auparavant ! Plein écran, fenêtré etc... votre form sera toujours la-même chez tous ! Ceci enlève aussi les problèmes de résolution d'écran : inutile de vous casser la tête à programmer dans la résolution à laquelle tournera l'appli ! TRANKIL en somme...
Source
- 'ya un zip aussi pour illustrer !
- '------------------------------------
- 'code à placer dans une feuille nommer form1
- '2 procédures en tout (form_load et form_resize)
-
- 'ATTENTION CECI FAIT DU TAG DES OBJETS UNE VALEUR OCCUPEE :
- 'en utilisant cette technique,
- 'le tag de chaque objet devient
- 'une valeur nécessaire'à son foncionnement,
- 'donc inutilisable pour toute autre chose de votre crue...
-
-
- Private Sub Form_Load()
- On Error Resume Next
- Me.Tag = CStr(Me.Width) & ":" & CStr(Me.Height)
- For Each object In Me
- object.Tag = CStr(object.X1) & ":" & CStr(object.Y1) & ";" & CStr(object.X2) & "!" & CStr(object.Y2)
- object.Tag = CStr(object.Width) & ":" & CStr(object.Height) & ";" & CStr(object.Left) & "!" & CStr(object.Top)
- Next object
- End Sub
-
- Private Sub Form_Resize()
- On Error Resume Next
- For Each object In Me
- 'pour les graphiques
- object.X1 = Val(Mid(object.Tag, 1, InStr(object.Tag, ":") - 1)) * Me.Width / Val(Mid(Me.Tag, 1, InStr(Me.Tag, ":") - 1))
- object.Y1 = Val(Mid(object.Tag, InStr(object.Tag, ":") + 1, Len(object.Tag) - InStr(object.Tag, ":") + 1)) * Me.Height / Val(Mid(Me.Tag, InStr(Me.Tag, ":") + 1, Len(Me.Tag) - InStr(Me.Tag, ":") + 1))
- object.X2 = Val(Mid(object.Tag, InStr(object.Tag, ";") + 1, Len(object.Tag) - InStr(object.Tag, ";") + 1)) * Me.Width / Val(Mid(Me.Tag, 1, InStr(Me.Tag, ":") - 1))
- object.Y2 = Val(Mid(object.Tag, InStr(object.Tag, "!") + 1, Len(object.Tag) - InStr(object.Tag, "!") + 1)) * Me.Height / Val(Mid(Me.Tag, InStr(Me.Tag, ":") + 1, Len(Me.Tag) - InStr(Me.Tag, ":") + 1))
- 'pour le reste
- object.Width = Val(Mid(object.Tag, 1, InStr(object.Tag, ":") - 1)) * Me.Width / Val(Mid(Me.Tag, 1, InStr(Me.Tag, ":") - 1))
- object.Height = Val(Mid(object.Tag, InStr(object.Tag, ":") + 1, Len(object.Tag) - InStr(object.Tag, ":") + 1)) * Me.Height / Val(Mid(Me.Tag, InStr(Me.Tag, ":") + 1, Len(Me.Tag) - InStr(Me.Tag, ":") + 1))
- object.Left = Val(Mid(object.Tag, InStr(object.Tag, ";") + 1, Len(object.Tag) - InStr(object.Tag, ";") + 1)) * Me.Width / Val(Mid(Me.Tag, 1, InStr(Me.Tag, ":") - 1))
- object.Top = Val(Mid(object.Tag, InStr(object.Tag, "!") + 1, Len(object.Tag) - InStr(object.Tag, "!") + 1)) * Me.Height / Val(Mid(Me.Tag, InStr(Me.Tag, ":") + 1, Len(Me.Tag) - InStr(Me.Tag, ":") + 1))
- Next object
- End Sub
'ya un zip aussi pour illustrer !
'------------------------------------
'code à placer dans une feuille nommer form1
'2 procédures en tout (form_load et form_resize)
'ATTENTION CECI FAIT DU TAG DES OBJETS UNE VALEUR OCCUPEE :
'en utilisant cette technique,
'le tag de chaque objet devient
'une valeur nécessaire'à son foncionnement,
'donc inutilisable pour toute autre chose de votre crue...
Private Sub Form_Load()
On Error Resume Next
Me.Tag = CStr(Me.Width) & ":" & CStr(Me.Height)
For Each object In Me
object.Tag = CStr(object.X1) & ":" & CStr(object.Y1) & ";" & CStr(object.X2) & "!" & CStr(object.Y2)
object.Tag = CStr(object.Width) & ":" & CStr(object.Height) & ";" & CStr(object.Left) & "!" & CStr(object.Top)
Next object
End Sub
Private Sub Form_Resize()
On Error Resume Next
For Each object In Me
'pour les graphiques
object.X1 = Val(Mid(object.Tag, 1, InStr(object.Tag, ":") - 1)) * Me.Width / Val(Mid(Me.Tag, 1, InStr(Me.Tag, ":") - 1))
object.Y1 = Val(Mid(object.Tag, InStr(object.Tag, ":") + 1, Len(object.Tag) - InStr(object.Tag, ":") + 1)) * Me.Height / Val(Mid(Me.Tag, InStr(Me.Tag, ":") + 1, Len(Me.Tag) - InStr(Me.Tag, ":") + 1))
object.X2 = Val(Mid(object.Tag, InStr(object.Tag, ";") + 1, Len(object.Tag) - InStr(object.Tag, ";") + 1)) * Me.Width / Val(Mid(Me.Tag, 1, InStr(Me.Tag, ":") - 1))
object.Y2 = Val(Mid(object.Tag, InStr(object.Tag, "!") + 1, Len(object.Tag) - InStr(object.Tag, "!") + 1)) * Me.Height / Val(Mid(Me.Tag, InStr(Me.Tag, ":") + 1, Len(Me.Tag) - InStr(Me.Tag, ":") + 1))
'pour le reste
object.Width = Val(Mid(object.Tag, 1, InStr(object.Tag, ":") - 1)) * Me.Width / Val(Mid(Me.Tag, 1, InStr(Me.Tag, ":") - 1))
object.Height = Val(Mid(object.Tag, InStr(object.Tag, ":") + 1, Len(object.Tag) - InStr(object.Tag, ":") + 1)) * Me.Height / Val(Mid(Me.Tag, InStr(Me.Tag, ":") + 1, Len(Me.Tag) - InStr(Me.Tag, ":") + 1))
object.Left = Val(Mid(object.Tag, InStr(object.Tag, ";") + 1, Len(object.Tag) - InStr(object.Tag, ";") + 1)) * Me.Width / Val(Mid(Me.Tag, 1, InStr(Me.Tag, ":") - 1))
object.Top = Val(Mid(object.Tag, InStr(object.Tag, "!") + 1, Len(object.Tag) - InStr(object.Tag, "!") + 1)) * Me.Height / Val(Mid(Me.Tag, InStr(Me.Tag, ":") + 1, Len(Me.Tag) - InStr(Me.Tag, ":") + 1))
Next object
End Sub
Conclusion
Merci de me laisser VOS COMMENTAIRES ! @+ les programmeurs et programmeuses (ça fait bizare comme mot... ya bien un féminin à ce mot ?)
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
[WP7] DYNAMICALLY CHANGE STARTUP PAGE[WP7] DYNAMICALLY CHANGE STARTUP PAGE par KooKiz
Let's say that you want to allow the user to customize the startup page of your application. You can easily change the startup page by editing the 'NavigationPage' attribute in the manifest file. But the manifest cannot be modified once the applicatio...
Cliquez pour lire la suite de l'article par KooKiz SESSION SILVERLIGHT 5 3D : SLIDES ET DEMOSSESSION SILVERLIGHT 5 3D : SLIDES ET DEMOS par Groc
Durant les techdays, j'ai eu le plaisir d'animer une session sur Silverlight 5 et la 3D avec Simon Ferquel. Comme promis, voici nos slides et mes démos (celles avec le viper BSG) ici et là. Pour mémoire, les démos utilisent toutes le viper BSG...
Cliquez pour lire la suite de l'article par Groc [TECHDAYS 2012] SESSION WEBMATRIX 2 : LE COUTEAU SUISSE GRATUIT POUR VOS DéVELOPPEMENTS WEB - SLIDES[TECHDAYS 2012] SESSION WEBMATRIX 2 : LE COUTEAU SUISSE GRATUIT POUR VOS DéVELOPPEMENTS WEB - SLIDES par gpommier
Suite à la session que j'ai présenté sur WebMatrix 2, vous pouvez trouver les slides ici, ainsi que les démos en packages nuget : démos1 et démos2 J'en profite pour remercier chaleureusement tous ceux qui sont venus très nombreux à cette sess...
Cliquez pour lire la suite de l'article par gpommier [SHAREPOINT] LES SESSIONS TECHDAYS 2012.[SHAREPOINT] LES SESSIONS TECHDAYS 2012. par Patrick Guimonet
Voici donc pour ceux qui n'ont pas pu venir, ou ceux qui n'ont pas pu toutes les suivre la liste des sessions SharePoint aux TechDays 2012, que je mettrais à jour dès que les liens des vidéo seront disponibles. Ou ici : http...
Cliquez pour lire la suite de l'article par Patrick Guimonet TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3 par ROMELARD Fabrice
Speaker: Bernard Ourghanlian Cette session est comme chaque jour transmise en live par BrainSonic, et j'ai donc suivi cette troisième pleinière par ce moyen sur mon iPad . Elle est dédiée comme chaque année à la mise en perspective de l'é...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Forum
LISTER KEYS.KEYLISTER KEYS.KEY par Onin42
Cliquez pour lire la suite par Onin42
Logiciels
Tribler (2012)TRIBLER (2012)Tribler est un client pair à pair (P2P/Peer-to-Peer) open source avec la capacité de regarder des... Cliquez pour télécharger Tribler OneSwarm (2012)ONESWARM (2012)Le peer-to-peer qui protège votre vie privée, c'est OneSwarm.
Ce logiciel de peer-to-peer crypté... Cliquez pour télécharger OneSwarm PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning
|