bonjour,
toute la partie quadrillée est décaléeCitation:
excel 2010 : quand dans les options du book on agrandit la taille de la police de +2 il faut également ajuster avec +2
@+JP
Version imprimable
bonjour,
toute la partie quadrillée est décaléeCitation:
excel 2010 : quand dans les options du book on agrandit la taille de la police de +2 il faut également ajuster avec +2
@+JP
Il n'est et ne sera jamais possible de "corriger" par un "coefficient correcteur global" un résultat de calculs où interviennent séparément et de manière distincte des paramètres distincts.
Et ce : quel que puisse être le domaine concerné (informatique ou non)
Perdre de vue ou ne pas comprendre ce fait élémentaire relève carrément de la puérilité (la même que celle qui anime certains chercheurs de "martingales" et autres fantaisies ...)
La correction d'un calcul ne peut se faire que dans le calcul lui-même et en aucun cas sur son résultat.
Voilà qui est dit avec toute mon amitié, mais également toute ma sévérité.
J'abandonne sur leurs planètes ceux qui souhaitent continuer à délirer.
Pour moi ce qui déconne est la façon dont tu l'utilises !
Déjà j'ai simplifié mon extrait du code du post #523 sans facteur de zoom d'Excel à dessein
justement pour mettre en exergue cette fonction !
Et c'est comme pour les posts #45 & 48, tu n'en tiens pas compte et tu continues sur ta lancée …
Premier test à effectuer avec un zoom Excel à 100 % :
comparer le positionnement de l'UserForm entre les fenêtres d'Excel et de la feuille de calculs
quand elles sont maximisées ou pas car si déjà il y a des différences à 100%
alors ce n'est même pas la peine de continuer avec un autre zoom !
re
bonjour marc
je n'ai aucun problème a positionner a n'importe quel zoom de 50 a 400 , maximisée ou pas pour l'application ou l'activewindow ,avec 2007 et avec la facon dont je l utilise
et la facon dont je modifie le zoom avec les pairs et impairs n'est certainement pas un hasard comme je l'ai dis précédemment reste a comprendre pourquoi
d'où ma réflexion il y a quelques post peut être faut il raisonner autrement que mathématiquement
en tout cas avec Windows 7 et office 2007 ca match a 100%
et quand je dis que pointstoscreenpixels ne fait pas d'erreur pour s'en donner la preuve il suffit de faire un setcursorpos avec les donné obtenues avec ou sans zoom et sans calcul du zoom simplement avec pointstoscreenpixels
on se rends bien compte que le curseur est a ca place
pourquoi le cursor se pose bien sans calcul alors que l'userform il lui faut un calcul sur pointstoscreenpixelsen en plus de la conversion pixel to point
un petit détail aussi
si on fait un msgbox cellule.width sur un fichier non modifié on a 60 par defaut : a oui!!!!! et bien regarde en le sauvant en xml combien vaut la largeur par defaut vous allez avoir de surprises
Bonjour à tous,
est-ce que le résultat obtenu est normal avec ce code ??
Pièce jointe 290643Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 Sub textbox() Dim PtToPx#, Zooom@ Zooom = ActiveWindow.Zoom / 100 PtToPx = ((ActiveWindow.ActivePane.PointsToScreenPixelsX(ActiveSheet.[a1].Width) - ActiveWindow.ActivePane.PointsToScreenPixelsX(0)) / ActiveSheet.[a1].Width) / Zooom With UserForm1 .Show 0 .Top = (ActiveWindow.ActivePane.PointsToScreenPixelsY(ActiveCell.Top) / PtToPx) .Left = (ActiveWindow.ActivePane.PointsToScreenPixelsX(ActiveCell.Left) / PtToPx) '??????????????????????? End With With Worksheets("Feuil1").TextBox1 .Top = ActiveCell.Top - ActiveCell.Height .Left = 5 '??????????????????????? End With End Sub
oui si l'activecell est en colonne A
lance cela et donne moi la liste que tu obtiens dans le debug
les resultat seront faux mais on s'en fou il me faut cette listeCode:
1
2
3
4
5
6
7
8
9
10
11
12
13
14 Sub truc() Dim dpi As Double With ActiveWindow For i = 50 To 400 Step 10 .Zoom = i Z = (.Zoom) / 100 ppx = (((.ActivePane.PointsToScreenPixelsY(3) - .ActivePane.PointsToScreenPixelsY(0)) / 3) / Z) Debug.Print "Zoom = "; .Zoom & " ---> DPI = " & ppx * 72 & " ---> coeff =" & ppx Next .Zoom = 100 End With End Sub
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 Zoom = 50 ---> DPI = 96 ---> coeff =1,33333333333333 Zoom = 60 ---> DPI = 80 ---> coeff =1,11111111111111 Zoom = 70 ---> DPI = 102,857142857143 ---> coeff =1,42857142857143 Zoom = 80 ---> DPI = 90 ---> coeff =1,25 Zoom = 90 ---> DPI = 106,666666666667 ---> coeff =1,48148148148148 Zoom = 100 ---> DPI = 96 ---> coeff =1,33333333333333 Zoom = 110 ---> DPI = 87,2727272727273 ---> coeff =1,21212121212121 Zoom = 120 ---> DPI = 100 ---> coeff =1,38888888888889 Zoom = 130 ---> DPI = 92,3076923076923 ---> coeff =1,28205128205128 Zoom = 140 ---> DPI = 102,857142857143 ---> coeff =1,42857142857143 Zoom = 150 ---> DPI = 96 ---> coeff =1,33333333333333 Zoom = 160 ---> DPI = 90 ---> coeff =1,25 Zoom = 170 ---> DPI = 98,8235294117647 ---> coeff =1,37254901960784 Zoom = 180 ---> DPI = 93,3333333333333 ---> coeff =1,2962962962963 Zoom = 190 ---> DPI = 101,052631578947 ---> coeff =1,40350877192982 Zoom = 200 ---> DPI = 96 ---> coeff =1,33333333333333 Zoom = 210 ---> DPI = 91,4285714285714 ---> coeff =1,26984126984127 Zoom = 220 ---> DPI = 98,1818181818182 ---> coeff =1,36363636363636 Zoom = 230 ---> DPI = 93,9130434782609 ---> coeff =1,30434782608696 Zoom = 240 ---> DPI = 100 ---> coeff =1,38888888888889 Zoom = 250 ---> DPI = 96 ---> coeff =1,33333333333333 Zoom = 260 ---> DPI = 92,3076923076923 ---> coeff =1,28205128205128 Zoom = 270 ---> DPI = 97,7777777777778 ---> coeff =1,35802469135802 Zoom = 280 ---> DPI = 94,2857142857143 ---> coeff =1,30952380952381 Zoom = 290 ---> DPI = 99,3103448275862 ---> coeff =1,37931034482759 Zoom = 300 ---> DPI = 96 ---> coeff =1,33333333333333 Zoom = 310 ---> DPI = 92,9032258064516 ---> coeff =1,29032258064516 Zoom = 320 ---> DPI = 97,5 ---> coeff =1,35416666666667 Zoom = 330 ---> DPI = 94,5454545454545 ---> coeff =1,31313131313131 Zoom = 340 ---> DPI = 98,8235294117647 ---> coeff =1,37254901960784 Zoom = 350 ---> DPI = 96 ---> coeff =1,33333333333333 Zoom = 360 ---> DPI = 93,3333333333333 ---> coeff =1,2962962962963 Zoom = 370 ---> DPI = 97,2972972972973 ---> coeff =1,35135135135135 Zoom = 380 ---> DPI = 94,7368421052632 ---> coeff =1,31578947368421 Zoom = 390 ---> DPI = 98,4615384615385 ---> coeff =1,36752136752137 Zoom = 400 ---> DPI = 96 ---> coeff =1,33333333333333
maintenant ca
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14 Sub truc() Dim dpi As Double With ActiveWindow For i = 50 To 400 Step 10 .Zoom = i Z = (.Zoom) / 100 If (Z * 10) Mod 5 <> 0 And (Z * 10) Mod 10 <> 0 Then ssupp = 0.012: Z = Z + ssupp ppx = Round((((.ActivePane.PointsToScreenPixelsY(3) - .ActivePane.PointsToScreenPixelsY(0)) / 3) / Z)) Debug.Print "Zoom = "; .Zoom & " ---> DPI = " & ppx * 72 & " ---> coeff =" & ppx Next .Zoom = 100 End With end sub
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 Zoom = 50 ---> DPI = 72 ---> coeff =1 Zoom = 60 ---> DPI = 72 ---> coeff =1 Zoom = 70 ---> DPI = 72 ---> coeff =1 Zoom = 80 ---> DPI = 72 ---> coeff =1 Zoom = 90 ---> DPI = 72 ---> coeff =1 Zoom = 100 ---> DPI = 72 ---> coeff =1 Zoom = 110 ---> DPI = 72 ---> coeff =1 Zoom = 120 ---> DPI = 72 ---> coeff =1 Zoom = 130 ---> DPI = 72 ---> coeff =1 Zoom = 140 ---> DPI = 72 ---> coeff =1 Zoom = 150 ---> DPI = 72 ---> coeff =1 Zoom = 160 ---> DPI = 72 ---> coeff =1 Zoom = 170 ---> DPI = 72 ---> coeff =1 Zoom = 180 ---> DPI = 72 ---> coeff =1 Zoom = 190 ---> DPI = 72 ---> coeff =1 Zoom = 200 ---> DPI = 72 ---> coeff =1 Zoom = 210 ---> DPI = 72 ---> coeff =1 Zoom = 220 ---> DPI = 72 ---> coeff =1 Zoom = 230 ---> DPI = 72 ---> coeff =1 Zoom = 240 ---> DPI = 72 ---> coeff =1 Zoom = 250 ---> DPI = 72 ---> coeff =1 Zoom = 260 ---> DPI = 72 ---> coeff =1 Zoom = 270 ---> DPI = 72 ---> coeff =1 Zoom = 280 ---> DPI = 72 ---> coeff =1 Zoom = 290 ---> DPI = 72 ---> coeff =1 Zoom = 300 ---> DPI = 72 ---> coeff =1 Zoom = 310 ---> DPI = 72 ---> coeff =1 Zoom = 320 ---> DPI = 72 ---> coeff =1 Zoom = 330 ---> DPI = 72 ---> coeff =1 Zoom = 340 ---> DPI = 72 ---> coeff =1 Zoom = 350 ---> DPI = 72 ---> coeff =1 Zoom = 360 ---> DPI = 72 ---> coeff =1 Zoom = 370 ---> DPI = 72 ---> coeff =1 Zoom = 380 ---> DPI = 72 ---> coeff =1 Zoom = 390 ---> DPI = 72 ---> coeff =1 Zoom = 400 ---> DPI = 72 ---> coeff =1
mille excuse enlève le "round"
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 Zoom = 50 ---> DPI = 96 ---> coeff =1,33333333333333 Zoom = 60 ---> DPI = 78,4313725490196 ---> coeff =1,08932461873638 Zoom = 70 ---> DPI = 101,123595505618 ---> coeff =1,40449438202247 Zoom = 80 ---> DPI = 88,6699507389162 ---> coeff =1,23152709359606 Zoom = 90 ---> DPI = 105,263157894737 ---> coeff =1,46198830409357 Zoom = 100 ---> DPI = 96 ---> coeff =1,33333333333333 Zoom = 110 ---> DPI = 86,3309352517986 ---> coeff =1,19904076738609 Zoom = 120 ---> DPI = 99,009900990099 ---> coeff =1,37513751375138 Zoom = 130 ---> DPI = 91,4634146341463 ---> coeff =1,27032520325203 Zoom = 140 ---> DPI = 101,983002832861 ---> coeff =1,41643059490085 Zoom = 150 ---> DPI = 96 ---> coeff =1,33333333333333 Zoom = 160 ---> DPI = 89,3300248138958 ---> coeff =1,24069478908189 Zoom = 170 ---> DPI = 98,1308411214953 ---> coeff =1,36292834890966 Zoom = 180 ---> DPI = 92,7152317880795 ---> coeff =1,28771155261221 Zoom = 190 ---> DPI = 100,418410041841 ---> coeff =1,39470013947001 Zoom = 200 ---> DPI = 96 ---> coeff =1,33333333333333 Zoom = 210 ---> DPI = 90,9090909090909 ---> coeff =1,26262626262626 Zoom = 220 ---> DPI = 97,6491862567812 ---> coeff =1,35623869801085 Zoom = 230 ---> DPI = 93,4256055363322 ---> coeff =1,29757785467128 Zoom = 240 ---> DPI = 99,5024875621891 ---> coeff =1,38197899391929 Zoom = 250 ---> DPI = 96 ---> coeff =1,33333333333333 Zoom = 260 ---> DPI = 91,8836140888208 ---> coeff =1,27616130678918 Zoom = 270 ---> DPI = 97,3451327433628 ---> coeff =1,35201573254671 Zoom = 280 ---> DPI = 93,8833570412518 ---> coeff =1,30393551446183 Zoom = 290 ---> DPI = 98,9010989010989 ---> coeff =1,37362637362637 Zoom = 300 ---> DPI = 96 ---> coeff =1,33333333333333 Zoom = 310 ---> DPI = 92,5449871465296 ---> coeff =1,2853470437018 Zoom = 320 ---> DPI = 97,1357409713574 ---> coeff =1,34910751349108 Zoom = 330 ---> DPI = 94,2028985507246 ---> coeff =1,30837359098229 Zoom = 340 ---> DPI = 98,4759671746776 ---> coeff =1,36772176631497 Zoom = 350 ---> DPI = 96 ---> coeff =1,33333333333333 Zoom = 360 ---> DPI = 93,0232558139535 ---> coeff =1,29198966408269 Zoom = 370 ---> DPI = 96,9827586206897 ---> coeff =1,34698275862069 Zoom = 380 ---> DPI = 94,4386149003148 ---> coeff =1,31164742917104 Zoom = 390 ---> DPI = 98,159509202454 ---> coeff =1,36332651670075 Zoom = 400 ---> DPI = 96 ---> coeff =1,33333333333333
je n'arrive pas a voir si c'est ptscrennpix ou zoom qui fait la modif par serie chez toi tandis que chez moi c'est un sur deux (pairs et impairs)
que donne ca dans le debug
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14 Sub truc2() Dim dpi As Double With ActiveWindow For i = 50 To 400 Step 10 .Zoom = i Z = (.Zoom) / 100 Actptx = (.ActivePane.PointsToScreenPixelsX(3) - .ActivePane.PointsToScreenPixelsX(0)) / 3 Debug.Print "Zoom = "; .Zoom & " -> Actptx = " & Actptx Next .Zoom = 100 End With End Sub
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 Zoom = 50 -> Actptx = 0,666666666666667 Zoom = 60 -> Actptx = 0,666666666666667 Zoom = 70 -> Actptx = 1 Zoom = 80 -> Actptx = 1 Zoom = 90 -> Actptx = 1,33333333333333 Zoom = 100 -> Actptx = 1,33333333333333 Zoom = 110 -> Actptx = 1,33333333333333 Zoom = 120 -> Actptx = 1,66666666666667 Zoom = 130 -> Actptx = 1,66666666666667 Zoom = 140 -> Actptx = 2 Zoom = 150 -> Actptx = 2 Zoom = 160 -> Actptx = 2 Zoom = 170 -> Actptx = 2,33333333333333 Zoom = 180 -> Actptx = 2,33333333333333 Zoom = 190 -> Actptx = 2,66666666666667 Zoom = 200 -> Actptx = 2,66666666666667 Zoom = 210 -> Actptx = 2,66666666666667 Zoom = 220 -> Actptx = 3 Zoom = 230 -> Actptx = 3 Zoom = 240 -> Actptx = 3,33333333333333 Zoom = 250 -> Actptx = 3,33333333333333 Zoom = 260 -> Actptx = 3,33333333333333 Zoom = 270 -> Actptx = 3,66666666666667 Zoom = 280 -> Actptx = 3,66666666666667 Zoom = 290 -> Actptx = 4 Zoom = 300 -> Actptx = 4 Zoom = 310 -> Actptx = 4 Zoom = 320 -> Actptx = 4,33333333333333 Zoom = 330 -> Actptx = 4,33333333333333 Zoom = 340 -> Actptx = 4,66666666666667 Zoom = 350 -> Actptx = 4,66666666666667 Zoom = 360 -> Actptx = 4,66666666666667 Zoom = 370 -> Actptx = 5 Zoom = 380 -> Actptx = 5 Zoom = 390 -> Actptx = 5,33333333333333 Zoom = 400 -> Actptx = 5,33333333333333
bon ben c'est bien zoom qui fait le yoyo chez toi
j'ai les même série que toi a une échelle différente puisque tu es en dpi 96 et moi 120
ma serie
edit: oupss! non tu a des serie de 3 c'est complètement insensé
Citation:
Zoom = 50 -> Actptx = 1
Zoom = 60 -> Actptx = 1
Zoom = 70 -> Actptx = 1,33333333333333
Zoom = 80 -> Actptx = 1,33333333333333
Zoom = 90 -> Actptx = 1,66666666666667
Zoom = 100 -> Actptx = 1,66666666666667
Zoom = 110 -> Actptx = 2
Zoom = 120 -> Actptx = 2
Zoom = 130 -> Actptx = 2,33333333333333
Zoom = 140 -> Actptx = 2,33333333333333
Zoom = 150 -> Actptx = 2,66666666666667
Zoom = 160 -> Actptx = 2,66666666666667
Zoom = 170 -> Actptx = 3
Zoom = 180 -> Actptx = 3
Zoom = 190 -> Actptx = 3,33333333333333
Zoom = 200 -> Actptx = 3,33333333333333
Zoom = 210 -> Actptx = 3,66666666666667
Zoom = 220 -> Actptx = 3,66666666666667
Zoom = 230 -> Actptx = 4
Zoom = 240 -> Actptx = 4
Zoom = 250 -> Actptx = 4,33333333333333
Zoom = 260 -> Actptx = 4,33333333333333
Zoom = 270 -> Actptx = 4,66666666666667
Zoom = 280 -> Actptx = 4,66666666666667
Zoom = 290 -> Actptx = 5
Zoom = 300 -> Actptx = 5
Zoom = 310 -> Actptx = 5,33333333333333
Zoom = 320 -> Actptx = 5,33333333333333
Zoom = 330 -> Actptx = 5,66666666666667
Zoom = 340 -> Actptx = 5,66666666666667
Zoom = 350 -> Actptx = 6
Zoom = 360 -> Actptx = 6
Zoom = 370 -> Actptx = 6,33333333333333
Zoom = 380 -> Actptx = 6,33333333333333
Zoom = 390 -> Actptx = 6,66666666666667
Zoom = 400 -> Actptx = 6,66666666666667
bon ben la voila l'erreur je me suis mis en dpi 96 et j'obtiens bien les serie de 3 les meme que les tiennes
en dpi 96
comme je le soupçonnais ca va bien plus loin qu'une erreur dans la fonctionCode:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 Zoom = 50 -> Actptx = 0,666666666666667 Zoom = 60 -> Actptx = 0,666666666666667 Zoom = 70 -> Actptx = 1 Zoom = 80 -> Actptx = 1 Zoom = 90 -> Actptx = 1,33333333333333 Zoom = 100 -> Actptx = 1,33333333333333 Zoom = 110 -> Actptx = 1,33333333333333 Zoom = 120 -> Actptx = 1,66666666666667 Zoom = 130 -> Actptx = 1,66666666666667 Zoom = 140 -> Actptx = 2 Zoom = 150 -> Actptx = 2 Zoom = 160 -> Actptx = 2 Zoom = 170 -> Actptx = 2,33333333333333 Zoom = 180 -> Actptx = 2,33333333333333 Zoom = 190 -> Actptx = 2,66666666666667 Zoom = 200 -> Actptx = 2,66666666666667 Zoom = 210 -> Actptx = 2,66666666666667 Zoom = 220 -> Actptx = 3 Zoom = 230 -> Actptx = 3 Zoom = 240 -> Actptx = 3,33333333333333 Zoom = 250 -> Actptx = 3,33333333333333 Zoom = 260 -> Actptx = 3,33333333333333 Zoom = 270 -> Actptx = 3,66666666666667 Zoom = 280 -> Actptx = 3,66666666666667 Zoom = 290 -> Actptx = 4 Zoom = 300 -> Actptx = 4 Zoom = 310 -> Actptx = 4 Zoom = 320 -> Actptx = 4,33333333333333 Zoom = 330 -> Actptx = 4,33333333333333 Zoom = 340 -> Actptx = 4,66666666666667 Zoom = 350 -> Actptx = 4,66666666666667 Zoom = 360 -> Actptx = 4,66666666666667 Zoom = 370 -> Actptx = 5 Zoom = 380 -> Actptx = 5 Zoom = 390 -> Actptx = 5,33333333333333 Zoom = 400 -> Actptx = 5,33333333333333
en dpi 120 ceci me donne le point 0 left de la grille au quel j'ajoute les 4.4 et toi les -5
en dpi 96(100%) ca me donne une donnée complètement erronées (-158) avec tout maximiséCode:MsgBox .ActivePane.PointsToScreenPixelsX(0)
je comprends mieux pourquoi avec les apis ca fonctionne mieux
visiblement les fonction pointstoscreenpixels ne gèrent pas les profondeurs d'écran
tiens Nicolas fait toi plaisir
;)Code:
1
2
3
4
5
6
7
8
9
10
11
12
13 Sub ultimatemethode() With CreateObject("WScript.Shell"): ppx = .RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ThemeManager\LastLoadedDPI") / 72: End With With ActiveWindow Z = .Zoom / 100 X = .ActivePane.PointsToScreenPixelsX([D3].Left) / ppx Y = .ActivePane.PointsToScreenPixelsY([D3].Top) / ppx End With With UserForm1 .Show 0 .Left = X -5 .Top = Y -5 End With End Sub
Bien vu mais pourquoi le -5 au top ??, obligé de le retirer pour moi
et sur le portable obliger de retirer -5 au top et left
a oui c'est vrai c'est que le left le "-5" pardon
voila une méthode qui nous donne le coeff sans api
tu a essayé divers zoom ?
c'est quoi la différence entre tes deux pcs